Bug 1454357 - Remove the scrollbox binding r=NeilDeakin
authorTimothy Guan-tin Chien <timdream@gmail.com>
Wed, 09 Jan 2019 20:12:26 +0000
changeset 453203 3e99aed6c14d
parent 453202 b21a65e29e75
child 453204 33784a7ae90b
push id35348
push useropoprus@mozilla.com
push dateThu, 10 Jan 2019 09:38:54 +0000
treeherdermozilla-central@74bb778f7879 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeilDeakin
bugs1454357
milestone66.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 1454357 - Remove the scrollbox binding r=NeilDeakin With all the previous efforts, the scrollbox binding now does nothing but to create an inner box element holding the scrolling content. It turned out that inner box can be easily removed. The padding set by the document sheets can be moved to the srollbox element directly. The only gotcha is XULScrollElement::ScrollByIndex() -- it can now reach the child item frames directly from the scrolled frame. Depends on D15169 Differential Revision: https://phabricator.services.mozilla.com/D15170
browser/themes/linux/customizableui/panelUI.css
browser/themes/shared/customizableui/panelUI.inc.css
browser/themes/shared/tabs.inc.css
browser/themes/windows/customizableui/panelUI.css
dom/xul/XULScrollElement.cpp
toolkit/content/widgets/scrollbox.xml
toolkit/content/xul.css
toolkit/themes/shared/extensions/extensions.inc.css
--- a/browser/themes/linux/customizableui/panelUI.css
+++ b/browser/themes/linux/customizableui/panelUI.css
@@ -9,17 +9,17 @@
   background: var(--arrowpanel-background);
   color: var(--arrowpanel-color);
   border: 1px solid var(--arrowpanel-border-color);
   margin-top: -6px;
   padding-top: 1px;
 }
 
 /* Add some space at the top because there are no headers: */
-#BMB_bookmarksPopup menupopup > hbox > .popup-internal-box > .arrowscrollbox-scrollbox > .scrollbox-innerbox  {
+#BMB_bookmarksPopup menupopup > hbox > .popup-internal-box > .arrowscrollbox-scrollbox  {
   padding-top: 4px;
 }
 
 menuitem.subviewbutton {
   -moz-appearance: none !important;
 }
 
 .subviewradio > .radio-label-box {
--- a/browser/themes/shared/customizableui/panelUI.inc.css
+++ b/browser/themes/shared/customizableui/panelUI.inc.css
@@ -1117,21 +1117,21 @@ menuitem.panel-subview-footer@menuStateA
 }
 
 #BMB_bookmarksPopup menupopup > .bookmarks-actions-menuseparator {
   /* Hide bottom separator as the styled footer includes a top border serving the same purpose */
   display: none;
 }
 
 /* Popups with only one item don't have a footer */
-#BMB_bookmarksPopup menupopup[placespopup=true][singleitempopup=true] > hbox > .popup-internal-box > .arrowscrollbox-scrollbox > .scrollbox-innerbox,
+#BMB_bookmarksPopup menupopup[placespopup=true][singleitempopup=true] > hbox > .popup-internal-box > .arrowscrollbox-scrollbox,
 /* These popups never have a footer */
-#BMB_bookmarksToolbarPopup > hbox > .popup-internal-box > .arrowscrollbox-scrollbox > .scrollbox-innerbox,
-#BMB_unsortedBookmarksPopup > hbox > .popup-internal-box > .arrowscrollbox-scrollbox > .scrollbox-innerbox,
-#BMB_mobileBookmarksPopup > hbox > .popup-internal-box > .arrowscrollbox-scrollbox > .scrollbox-innerbox {
+#BMB_bookmarksToolbarPopup > hbox > .popup-internal-box > .arrowscrollbox-scrollbox,
+#BMB_unsortedBookmarksPopup > hbox > .popup-internal-box > .arrowscrollbox-scrollbox,
+#BMB_mobileBookmarksPopup > hbox > .popup-internal-box > .arrowscrollbox-scrollbox {
   /* And so they need some bottom padding: */
   padding-bottom: 4px;
 }
 
 /* Disabled (empty) item is always alone and never has an icon, so fix its left padding */
 #BMB_bookmarksPopup menupopup[emptyplacesresult] .bookmark-item.subviewbutton {
   padding-left: 6px;
 }
--- a/browser/themes/shared/tabs.inc.css
+++ b/browser/themes/shared/tabs.inc.css
@@ -49,17 +49,17 @@
 }
 
 @supports -moz-bool-pref("layout.css.emulate-moz-box-with-flex") {
   .tab-stack {
     /* Needed to allow tabs to shrink to be skinnier than their page-title: */
     min-width: 0;
   }
 
-  .tabbrowser-arrowscrollbox > .arrowscrollbox-scrollbox > .scrollbox-innerbox {
+  .tabbrowser-arrowscrollbox > .arrowscrollbox-scrollbox {
     /* Needed to prevent tabstrip from growing as wide as the sum of the tabs'
        page-title widths (when we'd rather have it be as wide as the window and
        compress the tabs to their minimum size): */
     max-width: 100%;
   }
 }
 
 .tabbrowser-tab {
--- a/browser/themes/windows/customizableui/panelUI.css
+++ b/browser/themes/windows/customizableui/panelUI.css
@@ -21,17 +21,17 @@
   background: var(--arrowpanel-background);
   color: var(--arrowpanel-color);
   border: 1px solid var(--arrowpanel-border-color);
   border-radius: 3.5px;
   margin-top: -4px;
 }
 
 /* Add some space at the top because there are no headers: */
-#BMB_bookmarksPopup menupopup[placespopup=true] > hbox > .popup-internal-box > .arrowscrollbox-scrollbox > .scrollbox-innerbox  {
+#BMB_bookmarksPopup menupopup[placespopup=true] > hbox > .popup-internal-box > .arrowscrollbox-scrollbox  {
   padding-top: 4px;
 }
 
 /* bookmark panel separator */
 #BMB_bookmarksPopup menuseparator {
   padding-top: 0;
   padding-bottom: 0;
 }
--- a/dom/xul/XULScrollElement.cpp
+++ b/dom/xul/XULScrollElement.cpp
@@ -31,32 +31,26 @@ void XULScrollElement::ScrollByIndex(int
   }
 
   nsIFrame* scrolledFrame = sf->GetScrolledFrame();
   if (!scrolledFrame) {
     aRv.Throw(NS_ERROR_FAILURE);
     return;
   }
 
-  nsIFrame* scrolledBox = nsBox::GetChildXULBox(scrolledFrame);
-  if (!scrolledBox) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-
   nsRect rect;
 
   // now get the element's first child
-  nsIFrame* child = nsBox::GetChildXULBox(scrolledBox);
+  nsIFrame* child = nsBox::GetChildXULBox(scrolledFrame);
 
-  bool horiz = scrolledBox->IsXULHorizontal();
+  bool horiz = scrolledFrame->IsXULHorizontal();
   nsPoint cp = sf->GetScrollPosition();
   nscoord diff = 0;
   int32_t curIndex = 0;
-  bool isLTR = scrolledBox->IsXULNormalDirection();
+  bool isLTR = scrolledFrame->IsXULNormalDirection();
 
   nscoord frameWidth = 0;
   if (!isLTR && horiz) {
     nsCOMPtr<Document> doc = GetComposedDoc();
 
     nsCOMPtr<nsIPresShell> shell = doc->GetShell();
     if (!shell) {
       aRv.Throw(NS_ERROR_UNEXPECTED);
@@ -105,17 +99,17 @@ void XULScrollElement::ScrollByIndex(int
       }
       count++;
       if (count >= aIndex) {
         break;
       }
     }
 
   } else if (aIndex < 0) {
-    child = nsBox::GetChildXULBox(scrolledBox);
+    child = nsBox::GetChildXULBox(scrolledFrame);
     while (child) {
       rect = child->GetRect();
       if (count >= curIndex + aIndex) {
         break;
       }
       count++;
       child = nsBox::GetNextXULBox(child);
     }
--- a/toolkit/content/widgets/scrollbox.xml
+++ b/toolkit/content/widgets/scrollbox.xml
@@ -4,24 +4,16 @@
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 
 <bindings id="arrowscrollboxBindings"
    xmlns="http://www.mozilla.org/xbl"
    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    xmlns:xbl="http://www.mozilla.org/xbl">
 
-  <binding id="scrollbox" extends="chrome://global/content/bindings/general.xml#basecontrol">
-    <content>
-      <xul:box class="box-inherit scrollbox-innerbox" xbl:inherits="orient,align,pack,dir" flex="1">
-        <children/>
-      </xul:box>
-    </content>
-  </binding>
-
   <binding id="arrowscrollbox" extends="chrome://global/content/bindings/general.xml#basecontrol">
     <content>
       <xul:toolbarbutton class="scrollbutton-up"
                          anonid="scrollbutton-up"
                          xbl:inherits="orient,collapsed=notoverflowing,disabled=scrolledtostart"
                          onclick="_onButtonClick(event);"
                          onmousedown="_onButtonMouseDown(event, -1);"
                          onmouseup="_onButtonMouseUp(event);"
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
@@ -659,17 +659,16 @@ slider {
   /* This is a hint to layerization that the scrollbar thumb can never leave
      the scrollbar track. */
   overflow: hidden;
 }
 
 /******** scrollbox ********/
 
 scrollbox {
-  -moz-binding: url("chrome://global/content/bindings/scrollbox.xml#scrollbox");
   /* This makes it scrollable! */
   overflow: hidden;
 }
 
 scrollbox[smoothscroll=true] {
   scroll-behavior: smooth;
 }
 
--- a/toolkit/themes/shared/extensions/extensions.inc.css
+++ b/toolkit/themes/shared/extensions/extensions.inc.css
@@ -573,18 +573,18 @@ button.warning {
 
 .addon[status="uninstalled"][selected] {
   background-color: transparent;
 }
 
 
 /*** detail view ***/
 
-#detail-view > .scrollbox-innerbox {
-  margin: 8px 28px;
+#detail-view {
+  padding: 8px 28px;
 }
 
 #detail-view .loading {
   opacity: 0;
 }
 
 #detail-view[loading-extended] .loading {
   opacity: 1;