Bug 502292 - Minimum size of scrollbar thumb is far too small; r=(jmathies + neil) ui-r=beltzner

This commit is contained in:
Sylvain Pasche 2009-08-24 04:03:03 +02:00
Родитель 1e6d3e7896
Коммит c1aa55dec5
6 изменённых файлов: 74 добавлений и 5 удалений

Просмотреть файл

@ -43,3 +43,7 @@ skip-if(MOZ_WIDGET_TOOLKIT!="windows") != 403458-winmenu-ltr.xul 403458-winmenu-
skip-if(MOZ_WIDGET_TOOLKIT!="cocoa") == menulist-mirrored-when-rtl.xul menulist-mirrored-when-rtl-ref.xul
skip-if(MOZ_WIDGET_TOOLKIT!="cocoa") == searchfield-mirrored-when-rtl.xul searchfield-mirrored-when-rtl-ref.xul
skip-if(MOZ_WIDGET_TOOLKIT!="cocoa") == select-mirrored-when-rtl.html select-mirrored-when-rtl-ref.html
# Windows-only, depends on native scrollbar metrics
skip-if(MOZ_WIDGET_TOOLKIT!="windows") == scroll-thumb-minimum-size-notheme.html scroll-thumb-minimum-size-notheme-ref.html
skip-if(MOZ_WIDGET_TOOLKIT!="windows") == scroll-thumb-minimum-size-theme.html scroll-thumb-minimum-size-theme-ref.html

Просмотреть файл

@ -0,0 +1,5 @@
<!DOCTYPE html>
<meta http-equiv="msthemecompatible" content="no">
<div style="width: 200px; height: 200px; overflow: scroll;">
<div style="width: 100000px; height: 1000000px"></div>
</div>

Просмотреть файл

@ -0,0 +1,32 @@
<!DOCTYPE html>
<meta http-equiv="msthemecompatible" content="no">
<div style="width: 200px; height: 200px; overflow: scroll;">
<div style="width: 3725px; height: 3725px"></div>
</div>
<!--
The size of the inner div is computed as follow:
Input:
outer_div_size: size of the div containing the scrollbar
button_size: size of the scrollbar arrow buttons
scrollbar_thickness: width/height of a vertical/horizontal scrollbar respectively
thumb_size: height/width of the thumb of a vertical/horizontal scrollbar respectively
Output:
inner_div_size: size of the div to be scrolled
Formula:
slider_size = outer_div_size - 2 * button_size - scrollbar_thickness
thumb_size = slider_size * (outer_div_size / inner_div_size)
which gives:
inner_div_size = (outer_div_size - 2 * button_size - scrollbar_thickness) * (outer_div_size / thumb_size)
Testcase constants:
outer_div_size = 200
On XP/Vista at 96 dpi with theme disabled:
thumb_size = 8 (minimum size)
button_size = 17
scrollbar_thickness = 17
inner_div_size = (200 - 2 * 17 - 17) * (200 / 8) = 3725
-->

Просмотреть файл

@ -0,0 +1,4 @@
<!DOCTYPE html>
<div style="width: 200px; height: 200px; overflow: scroll;">
<div style="width: 100000px; height: 1000000px"></div>
</div>

Просмотреть файл

@ -0,0 +1,14 @@
<!DOCTYPE html>
<div style="width: 200px; height: 200px; overflow: scroll;">
<div style="width: 1753px; height: 1753px"></div>
</div>
<!--
See scroll-thumb-minimum-size-notheme.html for the formula.
On XP/Vista at 96 dpi with theme enabled:
thumb_size = 17 (minimum size)
button_size = 17
scrollbar_thickness = 17
inner_div_size = (200 - 2 * 17 - 17) * (200 / 17) = 1753
-->

Просмотреть файл

@ -2000,22 +2000,32 @@ nsNativeThemeWin::ClassicGetMinimumWidgetSize(nsIRenderingContext* aContext, nsI
#endif
(*aResult).width = (*aResult).height = 15;
break;
case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
#ifndef WINCE
(*aResult).width = ::GetSystemMetrics(SM_CYVTHUMB);
(*aResult).width = ::GetSystemMetrics(SM_CXVSCROLL);
(*aResult).height = ::GetSystemMetrics(SM_CYVTHUMB);
#else
(*aResult).width = 15;
(*aResult).height = 15;
#endif
(*aResult).height = (*aResult).width >> 1;
// Without theming, divide the thumb size by two in order to look more
// native
if (!GetTheme(aWidgetType))
(*aResult).height >>= 1;
*aIsOverridable = PR_FALSE;
break;
case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
#ifndef WINCE
(*aResult).height = ::GetSystemMetrics(SM_CXHTHUMB);
(*aResult).width = ::GetSystemMetrics(SM_CXHTHUMB);
(*aResult).height = ::GetSystemMetrics(SM_CYHSCROLL);
#else
(*aResult).width = 15;
(*aResult).height = 15;
#endif
(*aResult).width = (*aResult).height >> 1;
// Without theming, divide the thumb size by two in order to look more
// native
if (!GetTheme(aWidgetType))
(*aResult).width >>= 1;
*aIsOverridable = PR_FALSE;
break;
case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL: