Bug 1352238 Part 7 - Check if native theme supports the widget before using it. r=mats
authorLouis Chang <lochang@mozilla.com>
Tue, 05 Sep 2017 22:47:01 +0800
changeset 378930 f655236b4f528dfae0c3bc519b872567689d905e
parent 378929 31d1a1111f91bc0aa5c4cf50bfd9efaa811b58b9
child 378931 bd7c2148cc8079691e1330be389cb184347ce7c2
push id32445
push userarchaeopteryx@coole-files.de
push dateTue, 05 Sep 2017 21:54:33 +0000
treeherdermozilla-central@978d2539a8d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1352238
milestone57.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 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);