Bug 1333543 - Fix crash in nsRangeFrame::GetValueAtEventPoint on linux. r=mstange
authorJonathan Watt <jwatt@jwatt.org>
Tue, 17 Jan 2017 19:20:37 +0000
changeset 340984 9f130bfec2d52c059c2da93cb15bc30d018c49ce
parent 340983 011b9ce469dc80834cf1b91d574a7ec96ac14579
child 340985 507fcddedb1f1d4a24ca98dc65633dd655c8f17d
push id31322
push userkwierso@gmail.com
push dateTue, 07 Feb 2017 01:45:28 +0000
treeherdermozilla-central@af8a2573d0f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1333543
milestone54.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 1333543 - Fix crash in nsRangeFrame::GetValueAtEventPoint on linux. r=mstange
layout/forms/nsRangeFrame.cpp
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -557,17 +557,24 @@ nsRangeFrame::GetValueAtEventPoint(Widge
     nsPresContext *presContext = PresContext();
     bool notUsedCanOverride;
     LayoutDeviceIntSize size;
     presContext->GetTheme()->
       GetMinimumWidgetSize(presContext, this, NS_THEME_RANGE_THUMB, &size,
                            &notUsedCanOverride);
     thumbSize.width = presContext->DevPixelsToAppUnits(size.width);
     thumbSize.height = presContext->DevPixelsToAppUnits(size.height);
-    MOZ_ASSERT(thumbSize.width > 0 && thumbSize.height > 0);
+    // For GTK, GetMinimumWidgetSize returns zero for the thumb dimension
+    // perpendicular to the orientation of the slider.  That's okay since we
+    // only care about the dimension in the direction of the slider when using
+    // |thumbSize| below, but it means this assertion need to check
+    // IsHorizontal().
+    MOZ_ASSERT((IsHorizontal() && thumbSize.width > 0) ||
+               (!IsHorizontal() && thumbSize.height > 0),
+               "The thumb is expected to take up some slider space");
   } else {
     nsIFrame* thumbFrame = mThumbDiv->GetPrimaryFrame();
     if (thumbFrame) { // diplay:none?
       thumbSize = thumbFrame->GetSize();
     }
   }
 
   Decimal fraction;