Bug 1008455 - Avoid loading the xul.css UA style sheet when possible. r=bz CLOSED TREE
authorJonathan Watt <jwatt@jwatt.org>
Sat, 24 May 2014 19:51:06 +0100
changeset 184820 b42ec325e34dd39f86f6fe87bf4a7a431513962e
parent 184819 f11fd47e89a76cf52c807241448dedab4800d3f5
child 184821 027f3c05a629b613a9e88dcbb788ae34bfc9c688
push id43943
push userjwatt@jwatt.org
push dateSat, 24 May 2014 19:28:04 +0000
treeherdermozilla-inbound@b42ec325e34d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1008455
milestone32.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 1008455 - Avoid loading the xul.css UA style sheet when possible. r=bz CLOSED TREE
content/base/public/nsIContent.h
content/base/public/nsIDocument.h
content/svg/document/src/SVGDocument.h
content/xul/content/src/nsXULElement.cpp
layout/base/nsDocumentViewer.cpp
layout/style/nsLayoutStylesheetCache.cpp
layout/style/nsLayoutStylesheetCache.h
layout/style/ua.css
toolkit/content/jar.mn
toolkit/content/minimal-xul.css
toolkit/content/xul.css
--- a/content/base/public/nsIContent.h
+++ b/content/base/public/nsIContent.h
@@ -65,19 +65,21 @@ public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENT_IID)
 
   /**
    * Bind this content node to a tree.  If this method throws, the caller must
    * call UnbindFromTree() on the node.  In the typical case of a node being
    * appended to a parent, this will be called after the node has been added to
    * the parent's child list and before nsIDocumentObserver notifications for
    * the addition are dispatched.
-   * @param aDocument The new document for the content node.  Must match the
-   *                  current document of aParent, if aParent is not null.
-   *                  May not be null if aParent is null.
+   * @param aDocument The new document for the content node.  May not be null
+   *                  if aParent is null.  Must match the current document of
+   *                  aParent, if aParent is not null (note that
+   *                  aParent->GetCurrentDoc() can be null, in which case this
+   *                  must also be null).
    * @param aParent The new parent for the content node.  May be null if the
    *                node is being bound as a direct child of the document.
    * @param aBindingParent The new binding parent for the content node.
    *                       This is must either be non-null if a particular
    *                       binding parent is desired or match aParent's binding
    *                       parent.
    * @param aCompileEventHandlers whether to initialize the event handlers in
    *        the document (used by nsXULElement)
--- a/content/base/public/nsIDocument.h
+++ b/content/base/public/nsIDocument.h
@@ -1208,24 +1208,42 @@ public:
    */
   virtual void SetXMLDeclaration(const char16_t *aVersion,
                                  const char16_t *aEncoding,
                                  const int32_t aStandalone) = 0;
   virtual void GetXMLDeclaration(nsAString& aVersion,
                                  nsAString& aEncoding,
                                  nsAString& Standalone) = 0;
 
+  /**
+   * Returns true if this is what HTML 5 calls an "HTML document" (for example
+   * regular HTML document with Content-Type "text/html", image documents and
+   * media documents).  Returns false for XHTML and any other documents parsed
+   * by the XML parser.
+   */
   bool IsHTML() const
   {
     return mIsRegularHTML;
   }
+  bool IsXML() const
+  {
+    return !IsHTML();
+  }
   bool IsXUL() const
   {
     return mIsXUL;
   }
+  bool IsUnstyledDocument()
+  {
+    return IsLoadedAsData() || IsLoadedAsInteractiveData();
+  }
+  bool LoadsFullXULStyleSheetUpFront()
+  {
+    return IsXUL() || AllowXULXBL();
+  }
 
   virtual bool IsScriptEnabled() = 0;
 
   /**
    * Create an element with the specified name, prefix and namespace ID.
    */
   virtual nsresult CreateElem(const nsAString& aName, nsIAtom *aPrefix,
                               int32_t aNamespaceID,
--- a/content/svg/document/src/SVGDocument.h
+++ b/content/svg/document/src/SVGDocument.h
@@ -12,16 +12,21 @@
 class nsSVGElement;
 
 namespace mozilla {
 namespace dom {
 
 class SVGDocument MOZ_FINAL : public XMLDocument
 {
 public:
+  SVGDocument()
+    : XMLDocument("image/svg+xml")
+  {
+  }
+
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 
   // WebIDL API
   void GetDomain(nsAString& aDomain, ErrorResult& aRv);
   nsSVGElement* GetRootElement(ErrorResult& aRv);
 
 protected:
   virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -28,16 +28,17 @@
 #include "nsIDOMElement.h"
 #include "nsIDOMEventListener.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMXULCommandDispatcher.h"
 #include "nsIDOMXULElement.h"
 #include "nsIDOMElementCSSInlineStyle.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
 #include "nsIDocument.h"
+#include "nsLayoutStylesheetCache.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/EventStates.h"
 #include "nsFocusManager.h"
 #include "nsHTMLStyleSheet.h"
 #include "nsIJSRuntimeService.h"
 #include "nsNameSpaceManager.h"
 #include "nsIObjectInputStream.h"
@@ -724,27 +725,121 @@ nsXULElement::UpdateEditableState(bool a
     // Don't call through to Element here because the things
     // it does don't work for cases when we're an editable control.
     nsIContent *parent = GetParent();
 
     SetEditableFlag(parent && parent->HasFlag(NODE_IS_EDITABLE));
     UpdateState(aNotify);
 }
 
+/**
+ * Returns true if the user-agent style sheet rules for this XUL element are
+ * in minimal-xul.css instead of xul.css.
+ */
+static inline bool XULElementsRulesInMinimalXULSheet(nsIAtom* aTag)
+{
+  return // scrollbar parts:
+         aTag == nsGkAtoms::scrollbar ||
+         aTag == nsGkAtoms::scrollbarbutton ||
+         aTag == nsGkAtoms::scrollcorner ||
+         aTag == nsGkAtoms::slider ||
+         aTag == nsGkAtoms::thumb ||
+         aTag == nsGkAtoms::scale ||
+         // other
+         aTag == nsGkAtoms::resizer ||
+         aTag == nsGkAtoms::label ||
+         aTag == nsGkAtoms::videocontrols;
+}
+
+#ifdef DEBUG
+/**
+ * Returns true if aElement is a XUL element created by the video controls
+ * binding. HTML <video> and <audio> bindings pull in this binding. This
+ * binding creates lots of different types of XUL elements.
+ */
+static inline bool
+IsInVideoControls(nsXULElement* aElement)
+{
+  nsIContent* ancestor = aElement->GetParent();
+  while (ancestor) {
+    if (ancestor->NodeInfo()->Equals(nsGkAtoms::videocontrols, kNameSpaceID_XUL)) {
+      return true;
+    }
+    ancestor = ancestor->GetParent();
+  }
+  return false;
+}
+
+/**
+ * Returns true if aElement is an element created by the <binding
+ * id="feedreaderUI"> binding or one of the bindings bound to such an element.
+ * element in one of the binding for such an element. Only
+ * subscribe.xhtml#feedSubscribeLine pulls in the feedreaderUI binding. This
+ * binding creates lots of different types of XUL elements.
+ */
+bool
+IsInFeedSubscribeLine(nsXULElement* aElement)
+{
+  nsIContent* bindingParent = aElement->GetBindingParent();
+  if (bindingParent) {
+    while (bindingParent->GetBindingParent()) {
+      bindingParent = bindingParent->GetBindingParent();
+    }
+    nsIAtom* idAtom = bindingParent->GetID();
+    if (idAtom && idAtom->Equals(NS_LITERAL_STRING("feedSubscribeLine"))) {
+      return true;
+    }
+  }
+  return false;
+}
+#endif
+
 nsresult
 nsXULElement::BindToTree(nsIDocument* aDocument,
                          nsIContent* aParent,
                          nsIContent* aBindingParent,
                          bool aCompileEventHandlers)
 {
   nsresult rv = nsStyledElement::BindToTree(aDocument, aParent,
                                             aBindingParent,
                                             aCompileEventHandlers);
   NS_ENSURE_SUCCESS(rv, rv);
 
+  if (aDocument &&
+      !aDocument->LoadsFullXULStyleSheetUpFront() &&
+      !aDocument->IsUnstyledDocument()) {
+
+    // To save CPU cycles and memory, non-XUL documents only load the user
+    // agent style sheet rules for a minimal set of XUL elements such as
+    // 'scrollbar' that may be created implicitly for their content (those
+    // rules being in minimal-xul.css).  This is where we make sure that all
+    // the other XUL UA style sheet rules (xul.css) have been loaded if the
+    // minimal set is not sufficient.
+    //
+    // We do this during binding, not element construction, because elements
+    // can be moved from the document that creates them to another document.
+
+    if (!XULElementsRulesInMinimalXULSheet(Tag())) {
+      aDocument->EnsureOnDemandBuiltInUASheet(nsLayoutStylesheetCache::XULSheet());
+      // To keep memory usage down it is important that we try and avoid
+      // pulling xul.css into non-XUL documents. That should be very rare, and
+      // for HTML we currently should only pull it in if the document contains
+      // an <audio> or <video> element. This assertion is here to make sure
+      // that we don't fail to notice if a change to bindings causes us to
+      // start pulling in xul.css much more frequently. If this assertion
+      // fails then we need to figure out why, and how we can continue to avoid
+      // pulling in xul.css.
+      // Note that add-ons may introduce bindings that cause this assertion to
+      // fire.
+      NS_ASSERTION(IsInVideoControls(this) ||
+                   IsInFeedSubscribeLine(this),
+                   "Unexpected XUL element in non-XUL doc");
+    }
+  }
+
   if (aDocument) {
       NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
                    "Missing a script blocker!");
       // We're in a document now.  Kick off the frame load.
       LoadSrc();
   }
 
   return rv;
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -2275,16 +2275,30 @@ nsDocumentViewer::CreateStyleSet(nsIDocu
       !sheet) {
     delete styleSet;
     return NS_ERROR_OUT_OF_MEMORY;
   }
   // quirk.css needs to come after the regular UA sheet (or more precisely,
   // after the html.css and so forth that the UA sheet imports).
   styleSet->PrependStyleSheet(nsStyleSet::eAgentSheet, quirkClone);
   styleSet->SetQuirkStyleSheet(quirkClone);
+  if (aDocument->LoadsFullXULStyleSheetUpFront()) {
+    // nsXULElement::BindToTree loads xul.css on-demand if we don't load it
+    // up-front here.
+    sheet = nsLayoutStylesheetCache::XULSheet();
+    if (sheet) {
+      styleSet->PrependStyleSheet(nsStyleSet::eAgentSheet, sheet);
+    }
+  }
+  sheet = nsLayoutStylesheetCache::MinimalXULSheet();
+  if (sheet) {
+    // Load the minimal XUL rules for scrollbars and a few other XUL things
+    // that non-XUL (typically HTML) documents commonly use.
+    styleSet->PrependStyleSheet(nsStyleSet::eAgentSheet, sheet);
+  }
   styleSet->PrependStyleSheet(nsStyleSet::eAgentSheet,
                               nsLayoutStylesheetCache::UASheet());
 
   nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
   if (sheetService) {
     sheetService->AgentStyleSheets()->EnumerateForwards(AppendAgentSheet,
                                                         styleSet);
     sheetService->UserStyleSheets()->EnumerateBackwards(PrependUserSheet,
--- a/layout/style/nsLayoutStylesheetCache.cpp
+++ b/layout/style/nsLayoutStylesheetCache.cpp
@@ -144,16 +144,36 @@ nsLayoutStylesheetCache::UASheet()
   EnsureGlobal();
   if (!gStyleCache)
     return nullptr;
 
   return gStyleCache->mUASheet;
 }
 
 nsCSSStyleSheet*
+nsLayoutStylesheetCache::MinimalXULSheet()
+{
+  EnsureGlobal();
+  if (!gStyleCache)
+    return nullptr;
+
+  return gStyleCache->mMinimalXULSheet;
+}
+
+nsCSSStyleSheet*
+nsLayoutStylesheetCache::XULSheet()
+{
+  EnsureGlobal();
+  if (!gStyleCache)
+    return nullptr;
+
+  return gStyleCache->mXULSheet;
+}
+
+nsCSSStyleSheet*
 nsLayoutStylesheetCache::QuirkSheet()
 {
   EnsureGlobal();
   if (!gStyleCache)
     return nullptr;
 
   return gStyleCache->mQuirkSheet;
 }
@@ -225,16 +245,18 @@ nsLayoutStylesheetCache::SizeOfIncluding
   #define MEASURE(s) n += s ? s->SizeOfIncludingThis(aMallocSizeOf) : 0;
 
   MEASURE(mScrollbarsSheet);
   MEASURE(mFormsSheet);
   MEASURE(mNumberControlSheet);
   MEASURE(mUserContentSheet);
   MEASURE(mUserChromeSheet);
   MEASURE(mUASheet);
+  MEASURE(mMinimalXULSheet);
+  MEASURE(mXULSheet);
   MEASURE(mQuirkSheet);
   MEASURE(mFullScreenOverrideSheet);
   MEASURE(mSVGSheet);
   if (mMathMLSheet) {
     MEASURE(mMathMLSheet);
   }
 
   // Measurement of the following members may be added later if DMD finds it is
@@ -263,16 +285,28 @@ nsLayoutStylesheetCache::nsLayoutStylesh
   // per-profile, since they're profile-invariant.
   nsCOMPtr<nsIURI> uri;
   NS_NewURI(getter_AddRefs(uri), "resource://gre-resources/ua.css");
   if (uri) {
     LoadSheet(uri, mUASheet, true);
   }
   NS_ASSERTION(mUASheet, "Could not load ua.css");
 
+  NS_NewURI(getter_AddRefs(uri), "chrome://global/content/minimal-xul.css");
+  if (uri) {
+    LoadSheet(uri, mMinimalXULSheet, true);
+  }
+  NS_ASSERTION(mMinimalXULSheet, "Could not load minimal-xul.css");
+
+  NS_NewURI(getter_AddRefs(uri), "chrome://global/content/xul.css");
+  if (uri) {
+    LoadSheet(uri, mXULSheet, true);
+  }
+  NS_ASSERTION(mXULSheet, "Could not load xul.css");
+
   NS_NewURI(getter_AddRefs(uri), "resource://gre-resources/quirk.css");
   if (uri) {
     LoadSheet(uri, mQuirkSheet, true);
   }
   NS_ASSERTION(mQuirkSheet, "Could not load quirk.css");
 
   NS_NewURI(getter_AddRefs(uri), "resource://gre-resources/full-screen-override.css");
   if (uri) {
--- a/layout/style/nsLayoutStylesheetCache.h
+++ b/layout/style/nsLayoutStylesheetCache.h
@@ -34,16 +34,18 @@ class nsLayoutStylesheetCache MOZ_FINAL
   static nsCSSStyleSheet* ScrollbarsSheet();
   static nsCSSStyleSheet* FormsSheet();
   // This function is expected to return nullptr when the dom.forms.number
   // pref is disabled.
   static nsCSSStyleSheet* NumberControlSheet();
   static nsCSSStyleSheet* UserContentSheet();
   static nsCSSStyleSheet* UserChromeSheet();
   static nsCSSStyleSheet* UASheet();
+  static nsCSSStyleSheet* MinimalXULSheet();
+  static nsCSSStyleSheet* XULSheet();
   static nsCSSStyleSheet* QuirkSheet();
   static nsCSSStyleSheet* FullScreenOverrideSheet();
   static nsCSSStyleSheet* SVGSheet();
   static nsCSSStyleSheet* MathMLSheet();
 
   static void Shutdown();
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
@@ -62,15 +64,17 @@ private:
   static nsLayoutStylesheetCache* gStyleCache;
   static mozilla::css::Loader* gCSSLoader;
   nsRefPtr<nsCSSStyleSheet> mScrollbarsSheet;
   nsRefPtr<nsCSSStyleSheet> mFormsSheet;
   nsRefPtr<nsCSSStyleSheet> mNumberControlSheet;
   nsRefPtr<nsCSSStyleSheet> mUserContentSheet;
   nsRefPtr<nsCSSStyleSheet> mUserChromeSheet;
   nsRefPtr<nsCSSStyleSheet> mUASheet;
+  nsRefPtr<nsCSSStyleSheet> mMinimalXULSheet;
+  nsRefPtr<nsCSSStyleSheet> mXULSheet;
   nsRefPtr<nsCSSStyleSheet> mQuirkSheet;
   nsRefPtr<nsCSSStyleSheet> mFullScreenOverrideSheet;
   nsRefPtr<nsCSSStyleSheet> mSVGSheet;
   nsRefPtr<nsCSSStyleSheet> mMathMLSheet;
 };
 
 #endif
--- a/layout/style/ua.css
+++ b/layout/style/ua.css
@@ -1,14 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 @import url(resource://gre-resources/html.css);
-@import url(chrome://global/content/xul.css);
 
 @namespace parsererror url(http://www.mozilla.org/newlayout/xml/parsererror.xml);
 @namespace xul url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
 
 /* magic -- some of these rules are important to keep pages from overriding
             them
 */
 
--- a/toolkit/content/jar.mn
+++ b/toolkit/content/jar.mn
@@ -2,16 +2,17 @@ toolkit.jar:
 %  content global %content/global/ contentaccessible=yes
 %  content global-platform %content/global-platform/ platform
 %  content global-region %content/global-region/
 # provide the nsTransferable in nsDragAndDrop.js to extensions that have to
 # work with Geckos from before 1.9, when there was a separate file
 %  override chrome://global/content/nsTransferable.js chrome://global/content/nsDragAndDrop.js
 *  content/global/license.html                (license.html)
    content/global/XPCNativeWrapper.js         (XPCNativeWrapper.js)
+*  content/global/minimal-xul.css             (minimal-xul.css)
 *  content/global/xul.css                     (xul.css)
    content/global/textbox.css                 (textbox.css)
    content/global/menulist.css                (menulist.css)
    content/global/about.js                    (about.js)
    content/global/about.xhtml                 (about.xhtml)
    content/global/aboutAbout.js               (aboutAbout.js)
    content/global/aboutAbout.xhtml            (aboutAbout.xhtml)
    content/global/aboutRights.xhtml           (aboutRights.xhtml)
copy from toolkit/content/xul.css
copy to toolkit/content/minimal-xul.css
--- a/toolkit/content/xul.css
+++ b/toolkit/content/minimal-xul.css
@@ -1,23 +1,30 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-/** this should only contain XUL dialog and document window widget defaults. Defaults for widgets of
-    a particular application should be in that application's style sheet.
-	For example style definitions for navigator can be found in navigator.css
-
-   THIS FILE IS LOCKED DOWN.  YOU ARE NOT ALLOWED TO MODIFY IT WITHOUT FIRST HAVING YOUR
-   CHANGES REVIEWED BY enndeakin@sympatico.ca
-**/
+/**
+ * This file should only contain a minimal set of rules for the XUL elements
+ * that may be implicitly created as part of HTML/SVG documents (e.g.
+ * scrollbars).  Rules for everything else related to XUL can be found in
+ * xul.css.  (This split of the XUL rules is to minimize memory use and improve
+ * performance in HTML/SVG documents.)
+ *
+ * This file should also not contain any app specific styling.  Defaults for
+ * widgets of a particular application should be in that application's style
+ * sheet.  For example style definitions for navigator can be found in
+ * navigator.css.
+ *
+ * THIS FILE IS LOCKED DOWN.  YOU ARE NOT ALLOWED TO MODIFY IT WITHOUT FIRST
+ * HAVING YOUR CHANGES REVIEWED BY enndeakin@gmail.com
+ */
 
 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
 @namespace html url("http://www.w3.org/1999/xhtml"); /* namespace for HTML elements */
-@namespace xbl url("http://www.mozilla.org/xbl"); /* namespace for XBL elements */
 
 * {
   -moz-user-focus: ignore;
   -moz-user-select: none;
   display: -moz-box;
   box-sizing: border-box;
 }
 
@@ -37,723 +44,16 @@
 }
 
 /* hide the content, but don't destroy the frames */
 [collapsed="true"],
 [moz-collapsed="true"] {
   visibility: collapse;
 }
 
-
-/* ::::::::::
-   :: Rules for 'hiding' portions of the chrome for special
-   :: kinds of windows (not JUST browser windows) with toolbars
-   ::::: */
-
-window[chromehidden~="menubar"] .chromeclass-menubar,
-window[chromehidden~="directories"] .chromeclass-directories,
-window[chromehidden~="status"] .chromeclass-status,
-window[chromehidden~="extrachrome"] .chromeclass-extrachrome,
-window[chromehidden~="location"] .chromeclass-location,
-window[chromehidden~="location"][chromehidden~="toolbar"] .chromeclass-toolbar,
-window[chromehidden~="toolbar"] .chromeclass-toolbar-additional {
-  display: none;
-}
-
-/* ::::::::::
-   :: Rules for forcing direction for entry and display of URIs
-   :: or URI elements
-   ::::: */
-
-.uri-element {
-  direction: ltr !important;
-}
-
-/****** elements that have no visual representation ******/
-
-script, data,
-xbl|children,
-commands, commandset, command,
-broadcasterset, broadcaster, observes,
-keyset, key, toolbarpalette, toolbarset,
-template, rule, conditions, action,
-bindings, binding, content, member, triple,
-treechildren, treeitem, treeseparator, treerow, treecell {
-  display: none;
-}
-
-/********** focus rules **********/
-
-button,
-checkbox,
-colorpicker[type="button"],
-datepicker[type="grid"],
-menulist,
-radiogroup,
-tree,
-browser,
-editor,
-iframe {
-  -moz-user-focus: normal;
-}
-
-menulist[editable="true"] {
-  -moz-user-focus: ignore;
-}
-
-/******** window & page ******/
-
-window,
-page {
-  overflow: -moz-hidden-unscrollable;
-  -moz-box-orient: vertical;
-}
-
-/******** box *******/
-
-vbox {
-  -moz-box-orient: vertical;
-}
-
-bbox {
-  -moz-box-align: baseline;
-}
-
-/********** button **********/
-
-button {
-  -moz-binding: url("chrome://global/content/bindings/button.xml#button");
-}
-
-button[type="repeat"] {
-  -moz-binding: url("chrome://global/content/bindings/button.xml#button-repeat");
-}
-
-button[type="menu"], button[type="panel"] {
-  -moz-binding: url("chrome://global/content/bindings/button.xml#menu");
-}
-
-button[type="menu-button"] {
-  -moz-binding: url("chrome://global/content/bindings/button.xml#menu-button");
-}
-
-%ifdef MOZ_WIDGET_GTK
-/********* detection of system setting to use icons in buttons ***********/
-button[label]:not([label=""]) > .button-box > .button-icon:not(:-moz-system-metric(images-in-buttons)),
-button[label]:not([label=""]) > .button-box > .box-inherit > .button-icon:not(:-moz-system-metric(images-in-buttons)) {
-  display: none;
-}
-%endif
-
-/********** toolbarbutton **********/
-
-toolbarbutton {
-  -moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton");
-}
-
-toolbarbutton[type="menu"],
-toolbarbutton[type="panel"] {
-  -moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#menu");
-}
-
-toolbarbutton[type="menu-button"] {
-  -moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#menu-button");
-}
-
-toolbar[mode="icons"] .toolbarbutton-text,
-toolbar[mode="icons"] .toolbarbutton-multiline-text,
-toolbar[mode="text"] .toolbarbutton-icon {
-  display: none;
-}
-
-.toolbarbutton-multiline-text:not([wrap="true"]),
-.toolbarbutton-text[wrap="true"] {
-  display: none;
-}
-
-/******** browser, editor, iframe ********/
-
-browser,
-editor,
-iframe {
-  display: inline;
-}
-
-browser {
-  -moz-binding: url("chrome://global/content/bindings/browser.xml#browser");
-}
-
-editor {
-  -moz-binding: url("chrome://global/content/bindings/editor.xml#editor");
-}
-
-iframe {
-  -moz-binding: url("chrome://global/content/bindings/general.xml#iframe");
-}
-
-/********** notifications **********/
-
-notificationbox {
-  -moz-binding: url("chrome://global/content/bindings/notification.xml#notificationbox");
-  -moz-box-orient: vertical;
-}
-
-.notificationbox-stack {
-  overflow: -moz-hidden-unscrollable;
-}
-
-notification {
-  -moz-binding: url("chrome://global/content/bindings/notification.xml#notification");
-  transition: margin-top 300ms, opacity 300ms;
-}
-
-/*********** popup notification ************/
-popupnotification {
-  -moz-binding: url("chrome://global/content/bindings/notification.xml#popup-notification");
-}
-
-.popup-notification-menubutton:not([label]) {
-  display: none;
-}
-
-/********** image **********/
-
-image {
-  -moz-binding: url("chrome://global/content/bindings/general.xml#image");
-}
-
-/********** checkbox **********/
-
-checkbox {
-  -moz-binding: url("chrome://global/content/bindings/checkbox.xml#checkbox");
-}
-
-/********** radio **********/
-
-radiogroup {
-  -moz-binding: url("chrome://global/content/bindings/radio.xml#radiogroup");
-  -moz-box-orient: vertical;
-}
-
-radio {
-  -moz-binding: url("chrome://global/content/bindings/radio.xml#radio");
-}
-
-/******** groupbox *********/
-
-groupbox {
-  -moz-binding: url("chrome://global/content/bindings/groupbox.xml#groupbox");
-  display: -moz-groupbox;
-}
-
-caption {
-  -moz-binding: url("chrome://global/content/bindings/groupbox.xml#caption");
-}
-
-.groupbox-body {
-  -moz-box-pack: inherit;
-  -moz-box-align: inherit;
-  -moz-box-orient: vertical;
-}
-
-/******* toolbar *******/
-
-toolbox {
-  -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbox");
-  -moz-box-orient: vertical;
-}
-
-toolbar {
-  -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbar");
-}
-
-toolbar[customizing="true"][collapsed="true"] {
-  /* Some apps, e.g. Firefox, use 'collapsed' to hide toolbars.
-     Override it while customizing. */
-  visibility: visible;
-}
-
-toolbar[customizing="true"][hidden="true"] {
-  /* Some apps, e.g. SeaMonkey, use 'hidden' to hide toolbars.
-     Override it while customizing. */
-  display: -moz-box;
-}
-
-%ifdef XP_MACOSX
-toolbar[type="menubar"] {
-  min-height: 0 !important;
-  border: 0 !important;
-}
-%else
-toolbar[type="menubar"][autohide="true"] {
-  -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbar-menubar-autohide");
-  overflow: hidden;
-}
-
-toolbar[type="menubar"][autohide="true"][inactive="true"]:not([customizing="true"]) {
-  min-height: 0 !important;
-  height: 0 !important;
-  -moz-appearance: none !important;
-  border-style: none !important;
-}
-%endif
-
-toolbarseparator {
-  -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbardecoration");
-}
-
-toolbarspacer {
-  -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbardecoration");
-}
-
-toolbarspring {
-  -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbardecoration");
-  -moz-box-flex: 1000;
-}
-
-toolbarpaletteitem {
-  -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbarpaletteitem");
-}
-
-toolbarpaletteitem[place="palette"] {
-  -moz-box-orient: vertical;
-  -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbarpaletteitem-palette");
-}
-
-/********* menubar ***********/
-
-menubar {
-  -moz-binding: url("chrome://global/content/bindings/toolbar.xml#menubar");
-}
-
-/********* menu ***********/
-
-menubar > menu {
-  -moz-binding: url("chrome://global/content/bindings/menu.xml#menu-menubar");
-}
-
-menubar > menu.menu-iconic {
-  -moz-binding: url("chrome://global/content/bindings/menu.xml#menu-menubar-iconic");
-}
-
-menu {
-  -moz-binding: url("chrome://global/content/bindings/menu.xml#menu");
-}
-
-menu.menu-iconic {
-  -moz-binding: url("chrome://global/content/bindings/menu.xml#menu-iconic");
-}
-
-menubar > menu:empty {
-  visibility: collapse;
-}
-
-/********* menuitem ***********/
-
-menuitem {
-  -moz-binding: url("chrome://global/content/bindings/menu.xml#menuitem");
-}
-
-menuitem.menuitem-iconic {
-  -moz-binding: url("chrome://global/content/bindings/menu.xml#menuitem-iconic");
-}
-
-menuitem[description] {
-  -moz-binding: url("chrome://global/content/bindings/menu.xml#menuitem-iconic-desc-noaccel");
-}
-
-menuitem[type="checkbox"],
-menuitem[type="radio"] {
-  -moz-binding: url("chrome://global/content/bindings/menu.xml#menuitem-iconic");
-}
-
-menuitem.menuitem-non-iconic {
-  -moz-binding: url("chrome://global/content/bindings/menu.xml#menubutton-item");
-}
-
-.menu-text {
-  -moz-box-flex: 1;
-}
-
-%ifdef MOZ_WIDGET_GTK
-/********* detection of system setting to use icons in menus ***********/
-@media not all and (-moz-images-in-menus) {
-  .menu-iconic-left {
-    visibility: hidden;
-  }
-  :-moz-any(menuitem[type], .menuitem-with-favicon) > .menu-iconic-left {
-    visibility: visible;
-  }
-}
-%endif
-
-/********* menuseparator ***********/
-
-menuseparator {
-  -moz-binding: url("chrome://global/content/bindings/menu.xml#menuseparator");
-}
-
-/********* popup & menupopup ***********/
-
-/* <popup> is deprecated.  Only <menupopup> and <tooltip> are still valid. */
-
-popup,
-menupopup {
-  -moz-binding: url("chrome://global/content/bindings/popup.xml#popup");
-  -moz-box-orient: vertical;
-}
-
-panel {
-  -moz-binding: url("chrome://global/content/bindings/popup.xml#panel");
-  -moz-box-orient: vertical;
-}
-
-popup,
-menupopup,
-panel,
-tooltip {
-  display: -moz-popup;
-  z-index: 2147483647;
-  text-shadow: none;
-}
-
-tooltip {
-  -moz-binding: url("chrome://global/content/bindings/popup.xml#tooltip");
-  -moz-box-orient: vertical;
-  white-space: pre-wrap;
-  margin-top: 21px;
-}
-
-panel[type="arrow"] {
-  -moz-binding: url("chrome://global/content/bindings/popup.xml#arrowpanel");
-}
-
-%ifndef MOZ_WIDGET_GTK
-
-panel[type="arrow"]:not([animate="false"]) {
-  transform: scale(.4);
-  opacity: 0;
-  transition-property: transform, opacity;
-  transition-duration: 0.15s;
-  transition-timing-function: ease-out;
-}
-
-panel[type="arrow"][animate="open"] {
-  transform: none;
-  opacity: 1.0;
-}
-
-panel[arrowposition="after_start"] {
-  transform-origin: 20px top;
-}
-
-panel[arrowposition="after_end"] {
-  transform-origin: calc(100% - 20px) top;
-}
-
-panel[arrowposition="before_start"] {
-  transform-origin: 20px bottom;
-}
-
-panel[arrowposition="before_end"] {
-  transform-origin: calc(100% - 20px) bottom;
-}
-
-panel[arrowposition="start_before"] {
-  transform-origin: right 20px;
-}
-
-panel[arrowposition="start_after"] {
-  transform-origin: right calc(100% - 20px);
-}
-
-panel[arrowposition="end_before"] {
-  transform-origin: left 20px;
-}
-
-panel[arrowposition="end_after"] {
-  transform-origin: left calc(100% - 20px);
-}
-
-panel[arrowposition="after_start"][animate="cancel"],
-panel[arrowposition="before_end"][animate="cancel"],
-panel[arrowposition="end_before"][animate="cancel"],
-panel[arrowposition="start_after"][animate="cancel"] {
-  transform: none;
-}
-
-panel[arrowposition="after_end"][animate="cancel"],
-panel[arrowposition="before_start"][animate="cancel"],
-panel[arrowposition="start_before"][animate="cancel"],
-panel[arrowposition="end_after"][animate="cancel"] {
-  transform: none;
-}
-
-%endif
-
-%ifdef XP_MACOSX
-.statusbar-resizerpanel {
-  display: none;
-}
-%else
-window[sizemode="maximized"] statusbarpanel.statusbar-resizerpanel {
-  visibility: collapse;
-}
-%endif
-
-/******** grid **********/
-
-grid {
-  display: -moz-grid;
-}
-
-rows,
-columns {
-  display: -moz-grid-group;
-}
-
-row,
-column {
-  display: -moz-grid-line;
-}
-
-rows {
-  -moz-box-orient: vertical;
-}
-
-column {
-  -moz-box-orient: vertical;
-}
-
-/******** listbox **********/
-
-listbox {
-  -moz-binding: url("chrome://global/content/bindings/listbox.xml#listbox");
-}
-
-listhead {
-  -moz-binding: url("chrome://global/content/bindings/listbox.xml#listhead");
-}
-
-listrows {
-  -moz-binding: url("chrome://global/content/bindings/listbox.xml#listrows");
-}
-
-listitem {
-  -moz-binding: url("chrome://global/content/bindings/listbox.xml#listitem");
-}
-
-listitem[type="checkbox"] {
-  -moz-binding: url("chrome://global/content/bindings/listbox.xml#listitem-checkbox");
-}
-
-listheader {
-  -moz-binding: url("chrome://global/content/bindings/listbox.xml#listheader");
-  -moz-box-ordinal-group: 2147483646;
-}
-
-listcell {
-  -moz-binding: url("chrome://global/content/bindings/listbox.xml#listcell");
-}
-
-listcell[type="checkbox"] {
-  -moz-binding: url("chrome://global/content/bindings/listbox.xml#listcell-checkbox");
-}
-
-.listitem-iconic {
-  -moz-binding: url("chrome://global/content/bindings/listbox.xml#listitem-iconic");
-}
-
-listitem[type="checkbox"].listitem-iconic {
-  -moz-binding: url("chrome://global/content/bindings/listbox.xml#listitem-checkbox-iconic");
-}
-
-.listcell-iconic {
-  -moz-binding: url("chrome://global/content/bindings/listbox.xml#listcell-iconic");
-}
-
-listcell[type="checkbox"].listcell-iconic {
-  -moz-binding: url("chrome://global/content/bindings/listbox.xml#listcell-checkbox-iconic");
-}
-
-listbox {
-  display: -moz-grid;
-}
-
-listbox[rows] {
-  height: auto;
-}
-
-listcols, listhead, listrows, listboxbody {
-  display: -moz-grid-group;
-}
-
-listcol, listitem, listheaditem {
-  display: -moz-grid-line;
-}
-
-listbox {
-  -moz-user-focus: normal;
-  -moz-box-orient: vertical;
-  min-width: 0px;
-  min-height: 0px;
-  width: 200px;
-  height: 200px;
-}
-
-listhead {
-  -moz-box-orient: vertical;
-}
-
-listrows {
-  -moz-box-orient: vertical;
-  -moz-box-flex: 1;
-}
-
-listboxbody {
-  -moz-box-orient: vertical;
-  -moz-box-flex: 1;
-  /* Don't permit a horizontal scrollbar. See bug 285449 */
-  overflow-x: hidden !important;
-  overflow-y: auto;
-  min-height: 0px;
-}
-
-listcol {
-  -moz-box-orient: vertical;
-  min-width: 16px;
-}
-
-listcell {
-  -moz-box-align: center;
-}
-
-/******** tree ******/
-
-tree {
-  -moz-binding: url("chrome://global/content/bindings/tree.xml#tree");
-}
-
-treecols {
-  -moz-binding: url("chrome://global/content/bindings/tree.xml#treecols");
-}
-
-treecol {
-  -moz-binding: url("chrome://global/content/bindings/tree.xml#treecol");
-  -moz-box-ordinal-group: 2147483646;
-}
-
-treecol.treecol-image {
-  -moz-binding: url("chrome://global/content/bindings/tree.xml#treecol-image");
-}
-
-tree > treechildren {
-  display: -moz-box;
-  -moz-binding: url("chrome://global/content/bindings/tree.xml#treebody");
-  -moz-user-select: none;
-  -moz-box-flex: 1;
-}
-
-treerows {
-  -moz-binding: url("chrome://global/content/bindings/tree.xml#treerows");
-}
-
-treecolpicker {
-  -moz-binding: url("chrome://global/content/bindings/tree.xml#columnpicker");
-}
-
-tree {
-  -moz-box-orient: vertical;
-  min-width: 0px;
-  min-height: 0px;
-  width: 10px;
-  height: 10px;
-}
-
-tree[hidecolumnpicker="true"] > treecols > treecolpicker {
-  display: none;
-}
-
-treecol {
-  min-width: 16px;
-}
-
-treecol[hidden="true"] {
-  visibility: collapse;
-  display: -moz-box;
-}
-
-.tree-scrollable-columns {
-  /* Yes, Virginia, this makes it scrollable */
-  overflow: hidden;
-}
-
-/* ::::: lines connecting cells ::::: */
-tree:not([treelines="true"]) > treechildren::-moz-tree-line {
-  visibility: hidden;
-}
-
-treechildren::-moz-tree-cell(ltr) {
-  direction: ltr !important;
-}
-
-/********** deck & stack *********/
-
-deck {
-  display: -moz-deck;
-  -moz-binding: url("chrome://global/content/bindings/general.xml#deck");
-}
-
-stack, bulletinboard {
-  display: -moz-stack;
-}
-
-/********** tabbox *********/
-
-tabbox {
-  -moz-binding: url("chrome://global/content/bindings/tabbox.xml#tabbox");
-  -moz-box-orient: vertical;
-}
-
-tabs {
-  -moz-binding: url("chrome://global/content/bindings/tabbox.xml#tabs");
-  -moz-box-orient: horizontal;
-}
-
-tab {
-  -moz-binding: url("chrome://global/content/bindings/tabbox.xml#tab");
-  -moz-box-align: center;
-  -moz-box-pack: center;
-}
-
-tab[selected="true"]:not([ignorefocus="true"]) {
-  -moz-user-focus: normal;
-}
-
-tabpanels {
-  -moz-binding: url("chrome://global/content/bindings/tabbox.xml#tabpanels");
-  display: -moz-deck;
-}
-
-/********** progressmeter **********/
-
-progressmeter {
-  -moz-binding: url("chrome://global/content/bindings/progressmeter.xml#progressmeter");
-}
-
-/********** basic rule for anonymous content that needs to pass box properties through
- ********** to an insertion point parent that holds the real kids **************/
-
-.box-inherit {
-  -moz-box-orient: inherit;
-  -moz-box-pack: inherit;
-  -moz-box-align: inherit;
-  -moz-box-direction: inherit;
-}
-
 /********** label **********/
 
 description {
   -moz-binding: url("chrome://global/content/bindings/text.xml#text-base");
 }
 
 label {
   -moz-binding: url("chrome://global/content/bindings/text.xml#text-label");
@@ -767,231 +67,24 @@ label.text-link, label[onclick] {
 label[control], label.radio-label, label.checkbox-label, label.toolbarbutton-multiline-text {
   -moz-binding: url("chrome://global/content/bindings/text.xml#label-control");
 }
 
 html|span.accesskey {
   text-decoration: underline;
 }
 
-/********** textbox **********/
-
-textbox {
-  -moz-binding: url("chrome://global/content/bindings/textbox.xml#textbox");
-  -moz-user-select: text;
-  text-shadow: none;
-}
-
-textbox[multiline="true"] {
-  -moz-binding: url("chrome://global/content/bindings/textbox.xml#textarea");
-}
-
-.textbox-input-box {
-  -moz-binding: url("chrome://global/content/bindings/textbox.xml#input-box");
-}
-
-html|textarea.textbox-textarea {
-  resize: none;
-}
-
-textbox[resizable="true"] > .textbox-input-box > html|textarea.textbox-textarea {
-  resize: both;
-}
-
-.textbox-input-box[spellcheck="true"] {
-  -moz-binding: url("chrome://global/content/bindings/textbox.xml#input-box-spell");
-}
-
-textbox[type="timed"] {
-  -moz-binding: url("chrome://global/content/bindings/textbox.xml#timed-textbox");
-}
-
-textbox[type="search"] {
-  -moz-binding: url("chrome://global/content/bindings/textbox.xml#search-textbox");
-}
-
-textbox[type="number"] {
-  -moz-binding: url("chrome://global/content/bindings/numberbox.xml#numberbox");
-}
-
-.textbox-contextmenu:-moz-locale-dir(rtl) {
-  direction: rtl;
-}
-
-/********** autocomplete textbox **********/
-
-/* SeaMonkey does not use the new toolkit's autocomplete widget */
-%ifdef MOZ_SUITE
-
-textbox[type="autocomplete"] {
-  -moz-binding: url("chrome://global/content/autocomplete.xml#autocomplete");
-}
-
-panel[type="autocomplete"] {
-  -moz-binding: url("chrome://global/content/autocomplete.xml#autocomplete-result-popup");
-}
-
-.autocomplete-history-popup {
-  -moz-binding: url("chrome://global/content/autocomplete.xml#autocomplete-history-popup");
-}
-
-.autocomplete-treebody {
-  -moz-binding: url("chrome://global/content/autocomplete.xml#autocomplete-treebody");
-}
-
-.autocomplete-history-dropmarker {
-  -moz-binding: url("chrome://global/content/autocomplete.xml#history-dropmarker");
-}
-
-%else
-
-textbox[type="autocomplete"] {
-  -moz-binding: url("chrome://global/content/bindings/autocomplete.xml#autocomplete");
-}
-
-panel[type="autocomplete"] {
-  -moz-binding: url("chrome://global/content/bindings/autocomplete.xml#autocomplete-result-popup");
-}
-
-panel[type="autocomplete-richlistbox"] {
-  -moz-binding: url("chrome://global/content/bindings/autocomplete.xml#autocomplete-rich-result-popup");
-}
-
-/* FIXME: bug 616258 */
-
-.autocomplete-tree {
-  -moz-binding: url("chrome://global/content/bindings/autocomplete.xml#autocomplete-tree");
-  -moz-user-focus: ignore;
-}
-
-.autocomplete-treebody {
-  -moz-binding: url("chrome://global/content/bindings/autocomplete.xml#autocomplete-treebody");
-}
-
-.autocomplete-richlistbox {
-  -moz-binding: url("chrome://global/content/bindings/autocomplete.xml#autocomplete-richlistbox");
-  -moz-user-focus: ignore;
-}
-
-.autocomplete-richlistbox > scrollbox {
-  overflow-x: hidden !important;
-}
-
-.autocomplete-richlistitem {
-  -moz-binding: url("chrome://global/content/bindings/autocomplete.xml#autocomplete-richlistitem");
-  -moz-box-orient: vertical;
-  overflow: -moz-hidden-unscrollable;
-}
-
-.autocomplete-treerows {
-  -moz-binding: url("chrome://global/content/bindings/autocomplete.xml#autocomplete-treerows");
-}
-
-.autocomplete-history-dropmarker {
-  display: none;
-}
-
-.autocomplete-history-dropmarker[enablehistory="true"] {
-  display: -moz-box;
-  -moz-binding: url("chrome://global/content/bindings/autocomplete.xml#history-dropmarker");
-}
-
-.ac-ellipsis-after {
-  visibility: hidden;
-}
-
-.ac-url-text[type~="action"],
-.ac-action-text:not([type~="action"]) {
-  visibility: collapse;
-}
-
-%endif
-
-
-
-/* the C++ implementation of widgets is too eager to make popups visible.
-   this causes problems (bug 120155 and others), thus this workaround: */
-popup[type="autocomplete"][hidden="true"] {
-  visibility: hidden;
-}
-
-/* The following rule is here to fix bug 96899 (and now 117952).
-   Somehow trees create a situation
-   in which a popupset flows itself as if its popup child is directly within it
-   instead of the placeholder child that should actually be inside the popupset.
-   This is a stopgap measure, and it does not address the real bug.  */
-.autocomplete-result-popupset {
-  max-width: 0px;
-  width: 0 !important;
-  min-width: 0%;
-  min-height: 0%;
-}
-
-/********** colorpicker **********/
-
-colorpicker {
-  -moz-binding: url("chrome://global/content/bindings/colorpicker.xml#colorpicker");
-}
-
-colorpicker[type="button"] {
-  -moz-binding: url("chrome://global/content/bindings/colorpicker.xml#colorpicker-button");
-}
-
-.colorpickertile {
-  -moz-binding: url("chrome://global/content/bindings/colorpicker.xml#colorpickertile");
-}
-
-/********** menulist **********/
-
-menulist {
-  -moz-binding: url("chrome://global/content/bindings/menulist.xml#menulist");
-}
-
-menulist[editable="true"] {
-  -moz-binding: url("chrome://global/content/bindings/menulist.xml#menulist-editable");
-}
-
-menulist[type="description"] {
-  -moz-binding: url("chrome://global/content/bindings/menulist.xml#menulist-description");
-}
-
-menulist > menupopup > menuitem {
-  -moz-binding: url("chrome://global/content/bindings/menu.xml#menuitem-iconic-noaccel");
-}
-
-dropmarker {
-  -moz-binding: url("chrome://global/content/bindings/general.xml#dropmarker");
-}
-
 /********** resizer **********/
 
 resizer {
   -moz-binding: url("chrome://global/content/bindings/resizer.xml#resizer");
   position: relative;
   z-index: 2147483647;
 }
 
-/********** splitter **********/
-
-splitter {
-  -moz-binding: url("chrome://global/content/bindings/splitter.xml#splitter");
-}
-
-grippy {
-  -moz-binding: url("chrome://global/content/bindings/splitter.xml#grippy");
-}
-
-.tree-splitter {
-  width: 0px;
-  max-width: 0px;
-  min-width: 0% ! important;
-  min-height: 0% ! important;
-  -moz-box-ordinal-group: 2147483646;
-}
-
 /********** scrollbar **********/
 
 /* Scrollbars are never flipped even if BiDI kicks in. */
 scrollbar[orient="horizontal"] {
   direction: ltr;
 }
 
 thumb {
@@ -1033,232 +126,8 @@ scrollbarbutton[sbattr="scrollbar-down-t
 scrollbarbutton[sbattr="scrollbar-up-bottom"]:not(:-moz-system-metric(scrollbar-end-backward)),
 scrollbarbutton[sbattr="scrollbar-down-bottom"]:not(:-moz-system-metric(scrollbar-end-forward)) {
   display: none;
 }
 
 thumb[sbattr="scrollbar-thumb"]:-moz-system-metric(scrollbar-thumb-proportional) {
   -moz-box-flex: 1;
 }
-
-/******** scrollbox ********/
-
-scrollbox {
-  -moz-binding: url("chrome://global/content/bindings/scrollbox.xml#scrollbox");
-  /* This makes it scrollable! */
-  overflow: hidden;
-}
-
-arrowscrollbox {
-  -moz-binding: url("chrome://global/content/bindings/scrollbox.xml#arrowscrollbox");
-}
-
-arrowscrollbox[clicktoscroll="true"] {
-  -moz-binding: url("chrome://global/content/bindings/scrollbox.xml#arrowscrollbox-clicktoscroll");
-}
-
-autorepeatbutton {
-  -moz-binding: url("chrome://global/content/bindings/scrollbox.xml#autorepeatbutton");
-}
-
-/********** statusbar **********/
-
-statusbar {
-  -moz-binding: url("chrome://global/content/bindings/general.xml#statusbar");
-%ifdef XP_MACOSX
-  padding-right: 14px;
-%endif
-}
-
-statusbarpanel {
-  -moz-binding: url("chrome://global/content/bindings/general.xml#statusbarpanel");
-}
-
-.statusbarpanel-iconic {
-  -moz-binding: url("chrome://global/content/bindings/general.xml#statusbarpanel-iconic");
-}
-
-.statusbarpanel-iconic-text {
-  -moz-binding: url("chrome://global/content/bindings/general.xml#statusbarpanel-iconic-text");
-}
-
-.statusbarpanel-menu-iconic {
-  -moz-binding: url("chrome://global/content/bindings/general.xml#statusbarpanel-menu-iconic");
-}
-
-/********** spinbuttons ***********/
-
-spinbuttons {
-  -moz-binding: url("chrome://global/content/bindings/spinbuttons.xml#spinbuttons");
-}
-
-.spinbuttons-button {
-  -moz-user-focus: ignore;
-}
-
-/********** stringbundle **********/
-
-stringbundleset {
-  -moz-binding: url("chrome://global/content/bindings/stringbundle.xml#stringbundleset");
-  visibility: collapse;
-}
-
-stringbundle {
-  -moz-binding: url("chrome://global/content/bindings/stringbundle.xml#stringbundle");
-  visibility: collapse;
-}
-
-/********** dialog **********/
-
-dialog,
-dialog:root /* override :root from above */ {
-  -moz-binding: url("chrome://global/content/bindings/dialog.xml#dialog");
-  -moz-box-orient: vertical;
-}
-
-dialogheader {
-  -moz-binding: url("chrome://global/content/bindings/dialog.xml#dialogheader");
-}
-
-/********* page ************/
-
-page {
-  -moz-box-orient: vertical;
-}
-
-/********** wizard **********/
-
-wizard,
-wizard:root /* override :root from above */ {
-  -moz-binding: url("chrome://global/content/bindings/wizard.xml#wizard");
-  -moz-box-orient: vertical;
-  width: 40em;
-  height: 30em;
-}
-
-wizardpage {
-  -moz-binding: url("chrome://global/content/bindings/wizard.xml#wizardpage");
-  -moz-box-orient: vertical;
-  overflow: auto;
-}
-
-.wizard-header {
-  -moz-binding: url("chrome://global/content/bindings/wizard.xml#wizard-header");
-}
-
-.wizard-buttons {
-  -moz-binding: url("chrome://global/content/bindings/wizard.xml#wizard-buttons");
-}
-
-/********** preferences ********/
-
-prefwindow,
-prefwindow:root /* override :root from above */ {
-  -moz-binding: url("chrome://global/content/bindings/preferences.xml#prefwindow");
-  -moz-box-orient: vertical;
-}
-
-prefpane {
-  -moz-binding: url("chrome://global/content/bindings/preferences.xml#prefpane");
-  -moz-box-orient: vertical;
-}
-
-prefwindow > .paneDeckContainer {
-  overflow: hidden;
-}
-
-prefpane > .content-box {
-  overflow: hidden;
-}
-
-prefwindow[type="child"] > .paneDeckContainer {
-  overflow: -moz-hidden-unscrollable;
-}
-
-prefwindow[type="child"] > prefpane > .content-box {
-  -moz-box-flex: 1;
-  overflow: -moz-hidden-unscrollable;
-}
-
-preferences {
-  -moz-binding: url("chrome://global/content/bindings/preferences.xml#preferences");
-  visibility: collapse;
-}
-
-preference {
-  -moz-binding: url("chrome://global/content/bindings/preferences.xml#preference");
-  visibility: collapse;
-}
-
-radio[pane] {
-  -moz-binding: url("chrome://global/content/bindings/preferences.xml#panebutton") !important;
-  -moz-box-orient: vertical;
-  -moz-box-align: center;
-}
-
-prefwindow[chromehidden~="toolbar"] .chromeclass-toolbar {
-  display: none;
-}
-
-/********** expander ********/
-
-expander {
-  -moz-binding: url("chrome://global/content/bindings/expander.xml#expander");
-  -moz-box-orient: vertical;
-}
-
-
-/********** Rich Listbox ********/
-
-richlistbox {
-  -moz-binding: url('chrome://global/content/bindings/richlistbox.xml#richlistbox');
-  -moz-user-focus: normal;
-  -moz-box-orient: vertical;
-}
-
-richlistitem {
-  -moz-binding: url('chrome://global/content/bindings/richlistbox.xml#richlistitem');
-}
-
-richlistbox > listheader {
-  -moz-box-ordinal-group: 1;
-}
-
-/********** datepicker and timepicker ********/
-
-datepicker {
-  -moz-binding: url('chrome://global/content/bindings/datetimepicker.xml#datepicker');
-}
-
-datepicker[type="popup"] {
-  -moz-binding: url('chrome://global/content/bindings/datetimepicker.xml#datepicker-popup');
-}
-
-datepicker[type="grid"] {
-  -moz-binding: url('chrome://global/content/bindings/datetimepicker.xml#datepicker-grid');
-}
-
-timepicker {
-  -moz-binding: url('chrome://global/content/bindings/datetimepicker.xml#timepicker');
-}
-
-
-/*********** findbar ************/
-findbar {
-  -moz-binding: url('chrome://global/content/bindings/findbar.xml#findbar');
-}
-
-.findbar-textbox {
-  -moz-binding: url("chrome://global/content/bindings/findbar.xml#findbar-textbox");
-}
-
-
-/*********** filefield ************/
-filefield {
-  -moz-binding: url("chrome://global/content/bindings/filefield.xml#filefield");
-}
-
-/*********** tabmodalprompt ************/
-tabmodalprompt {
-  -moz-binding: url("chrome://global/content/tabprompts.xml#tabmodalprompt");
-  overflow: hidden;
-  text-shadow: none;
-}
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
@@ -1,53 +1,33 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-/** this should only contain XUL dialog and document window widget defaults. Defaults for widgets of
-    a particular application should be in that application's style sheet.
-	For example style definitions for navigator can be found in navigator.css
-
-   THIS FILE IS LOCKED DOWN.  YOU ARE NOT ALLOWED TO MODIFY IT WITHOUT FIRST HAVING YOUR
-   CHANGES REVIEWED BY enndeakin@sympatico.ca
-**/
+/**
+ * A minimal set of rules for the XUL elements that may be implicitly created
+ * as part of HTML/SVG documents (e.g. scrollbars) can be found over in
+ * minimal-xul.css.  Rules for everything else related to XUL can be found in
+ * this file.  Make sure you choose the correct style sheet when adding new
+ * rules.  (This split of the XUL rules is to minimize memory use and improve
+ * performance in HTML/SVG documents.)
+ *
+ * This file should also not contain any app specific styling.  Defaults for
+ * widgets of a particular application should be in that application's style
+ * sheet.  For example, style definitions for navigator can be found in
+ * navigator.css.
+ *
+ * THIS FILE IS LOCKED DOWN.  YOU ARE NOT ALLOWED TO MODIFY IT WITHOUT FIRST
+ * HAVING YOUR CHANGES REVIEWED BY enndeakin@gmail.com
+ */
 
 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
 @namespace html url("http://www.w3.org/1999/xhtml"); /* namespace for HTML elements */
 @namespace xbl url("http://www.mozilla.org/xbl"); /* namespace for XBL elements */
 
-* {
-  -moz-user-focus: ignore;
-  -moz-user-select: none;
-  display: -moz-box;
-  box-sizing: border-box;
-}
-
-:root {
-  text-rendering: optimizeLegibility;
-  -moz-binding: url("chrome://global/content/bindings/general.xml#root-element");
-  -moz-control-character-visibility: visible;
-}
-
-:root:-moz-locale-dir(rtl) {
-  direction: rtl;
-}
-
-/* hide the content and destroy the frame */
-[hidden="true"] {
-  display: none;
-}
-
-/* hide the content, but don't destroy the frames */
-[collapsed="true"],
-[moz-collapsed="true"] {
-  visibility: collapse;
-}
-
-
 /* ::::::::::
    :: Rules for 'hiding' portions of the chrome for special
    :: kinds of windows (not JUST browser windows) with toolbars
    ::::: */
 
 window[chromehidden~="menubar"] .chromeclass-menubar,
 window[chromehidden~="directories"] .chromeclass-directories,
 window[chromehidden~="status"] .chromeclass-status,
@@ -744,39 +724,16 @@ progressmeter {
 
 .box-inherit {
   -moz-box-orient: inherit;
   -moz-box-pack: inherit;
   -moz-box-align: inherit;
   -moz-box-direction: inherit;
 }
 
-/********** label **********/
-
-description {
-  -moz-binding: url("chrome://global/content/bindings/text.xml#text-base");
-}
-
-label {
-  -moz-binding: url("chrome://global/content/bindings/text.xml#text-label");
-}
-
-label.text-link, label[onclick] {
-  -moz-binding: url("chrome://global/content/bindings/text.xml#text-link");
-  -moz-user-focus: normal;
-}
-
-label[control], label.radio-label, label.checkbox-label, label.toolbarbutton-multiline-text {
-  -moz-binding: url("chrome://global/content/bindings/text.xml#label-control");
-}
-
-html|span.accesskey {
-  text-decoration: underline;
-}
-
 /********** textbox **********/
 
 textbox {
   -moz-binding: url("chrome://global/content/bindings/textbox.xml#textbox");
   -moz-user-select: text;
   text-shadow: none;
 }
 
@@ -956,24 +913,16 @@ menulist[type="description"] {
 menulist > menupopup > menuitem {
   -moz-binding: url("chrome://global/content/bindings/menu.xml#menuitem-iconic-noaccel");
 }
 
 dropmarker {
   -moz-binding: url("chrome://global/content/bindings/general.xml#dropmarker");
 }
 
-/********** resizer **********/
-
-resizer {
-  -moz-binding: url("chrome://global/content/bindings/resizer.xml#resizer");
-  position: relative;
-  z-index: 2147483647;
-}
-
 /********** splitter **********/
 
 splitter {
   -moz-binding: url("chrome://global/content/bindings/splitter.xml#splitter");
 }
 
 grippy {
   -moz-binding: url("chrome://global/content/bindings/splitter.xml#grippy");
@@ -982,68 +931,16 @@ grippy {
 .tree-splitter {
   width: 0px;
   max-width: 0px;
   min-width: 0% ! important;
   min-height: 0% ! important;
   -moz-box-ordinal-group: 2147483646;
 }
 
-/********** scrollbar **********/
-
-/* Scrollbars are never flipped even if BiDI kicks in. */
-scrollbar[orient="horizontal"] {
-  direction: ltr;
-}
-
-thumb {
-  -moz-binding: url(chrome://global/content/bindings/scrollbar.xml#thumb);
-  display: -moz-box !important;
-}
-
-.scale-thumb {
-  -moz-binding: url(chrome://global/content/bindings/scale.xml#scalethumb);
-}
-
-scrollbar, scrollbarbutton, scrollcorner, slider, thumb, scale {
-  -moz-user-select: none;
-}
-
-scrollcorner {
-  display: -moz-box !important;
-}
-
-scrollcorner[hidden="true"] {
-  display: none !important;
-}
-
-scrollbar[value="hidden"] {
-  visibility: hidden;
-}
-
-scale {
-  -moz-binding: url(chrome://global/content/bindings/scale.xml#scale);
-}
-
-.scale-slider {
-  -moz-binding: url(chrome://global/content/bindings/scale.xml#scaleslider);
-  -moz-user-focus: normal;
-}
-
-scrollbarbutton[sbattr="scrollbar-up-top"]:not(:-moz-system-metric(scrollbar-start-backward)),
-scrollbarbutton[sbattr="scrollbar-down-top"]:not(:-moz-system-metric(scrollbar-start-forward)),
-scrollbarbutton[sbattr="scrollbar-up-bottom"]:not(:-moz-system-metric(scrollbar-end-backward)),
-scrollbarbutton[sbattr="scrollbar-down-bottom"]:not(:-moz-system-metric(scrollbar-end-forward)) {
-  display: none;
-}
-
-thumb[sbattr="scrollbar-thumb"]:-moz-system-metric(scrollbar-thumb-proportional) {
-  -moz-box-flex: 1;
-}
-
 /******** scrollbox ********/
 
 scrollbox {
   -moz-binding: url("chrome://global/content/bindings/scrollbox.xml#scrollbox");
   /* This makes it scrollable! */
   overflow: hidden;
 }