Bug 1352238 Part 7 - Check if native theme supports the widget before using it. r?mats draft
authorLouis Chang <lochang@mozilla.com>
Tue, 05 Sep 2017 22:47:01 +0800
changeset 659113 15f96b5ab7fd80f721e4352f66526ba4ec931eda
parent 659112 a47e51037c52719768b1dcfeced7048ae0cab43f
child 659114 977e88f3697311ee109a5bb91bbafe671536a879
push id78020
push userlochang@mozilla.com
push dateTue, 05 Sep 2017 14:49:24 +0000
reviewersmats
bugs1352238
milestone57.0a1
Bug 1352238 Part 7 - Check if native theme supports the widget before using it. r?mats MozReview-Commit-ID: IKoYDzNCVx4
layout/xul/nsScrollbarFrame.cpp
--- a/layout/xul/nsScrollbarFrame.cpp
+++ b/layout/xul/nsScrollbarFrame.cpp
@@ -164,25 +164,24 @@ nsresult
 nsScrollbarFrame::GetXULMargin(nsMargin& aMargin)
 {
   nsresult rv = NS_ERROR_FAILURE;
   aMargin.SizeTo(0,0,0,0);
 
   if (LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0) {
     nsPresContext* presContext = PresContext();
     nsITheme* theme = presContext->GetTheme();
-    if (theme) {
+    if (theme && theme->ThemeSupportsWidget(presContext, this, NS_THEME_SCROLLBAR)) {
       LayoutDeviceIntSize size;
       bool isOverridable;
       theme->GetMinimumWidgetSize(presContext, this, NS_THEME_SCROLLBAR, &size,
                                   &isOverridable);
       if (IsXULHorizontal()) {
         aMargin.top = -presContext->DevPixelsToAppUnits(size.height);
-      }
-      else {
+      } else {
         aMargin.left = -presContext->DevPixelsToAppUnits(size.width);
       }
       rv = NS_OK;
     }
   }
 
   if (NS_FAILED(rv)) {
     rv = nsBox::GetXULMargin(aMargin);