Bug 377181 - 'Jump to here' system preference is not followed by (new) non-native scrollbars. r-cbarrett, sr=roc.

This commit is contained in:
mozilla.mano@sent.com 2007-04-11 17:36:40 -07:00
Родитель 3ed50f2b70
Коммит fc4f35d0d4
5 изменённых файлов: 46 добавлений и 1 удалений

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

@ -65,6 +65,7 @@
#include "nsIScrollbarFrame.h"
#include "nsISupportsArray.h"
#include "nsIScrollableView.h"
#include "nsILookAndFeel.h"
#include "nsRepeatService.h"
#include "nsBoxLayoutState.h"
#include "nsSprocketLayout.h"
@ -831,6 +832,21 @@ nsSliderFrame::MouseDown(nsIDOMEvent* aMouseEvent)
scrollToClick = PR_TRUE;
}
// Check if we should scroll-to-click regardless of the pressed button and
// modifiers
if (!scrollToClick) {
nsresult rv;
nsCOMPtr<nsILookAndFeel> lookNFeel =
do_GetService("@mozilla.org/widget/lookandfeel;1", &rv);
if (NS_SUCCEEDED(rv)) {
PRInt32 scrollToClickMetric;
rv = lookNFeel->GetMetric(nsILookAndFeel::eMetric_ScrollToClick,
scrollToClickMetric);
if (NS_SUCCEEDED(rv) && scrollToClickMetric == 1)
scrollToClick = PR_TRUE;
}
}
PRInt32 clientPosPx;
nsIntRect screenRect = GetScreenRect();
nscoord pos;

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

@ -130,6 +130,11 @@ pref("accessibility.warn_on_browsewithcaret", true);
// unless accessibility.tabfocus is set by the user.
pref("accessibility.tabfocus", 7);
pref("accessibility.tabfocus_applies_to_xul", false);
// On OS X, we follow the "Click in the scrollbar to:" system preference
// unless this preference was set manually
pref("ui.scrollToClick", 0);
#else
// Only on mac tabfocus is expected to handle UI widgets as well as web content
pref("accessibility.tabfocus_applies_to_xul", true);

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

@ -225,7 +225,15 @@ public:
* +-----------+
* 2 0
*/
eMetric_AlertNotificationOrigin
eMetric_AlertNotificationOrigin,
/**
* If true, clicking on a scrollbar (not as in dragging the thumb) defaults
* to scrolling the view corresponding to the clicked point. Otherwise, we
* only do so if the scrollbar is clicked using the middle mouse button or
* if shift is pressed when the scrollbar is clicked.
*/
eMetric_ScrollToClick
} nsMetricID;
enum {

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

@ -585,6 +585,20 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
}
}
break;
case eMetric_ScrollToClick:
{
CFPropertyListRef scrollToClickProperty =
::CFPreferencesCopyValue(CFSTR("AppleScrollerPagingBehavior"),
kCFPreferencesAnyApplication,
kCFPreferencesCurrentUser,
kCFPreferencesAnyHost);
aMetric = 0;
if (scrollToClickProperty) {
aMetric = (PRInt32)::CFBooleanGetValue((CFBooleanRef)scrollToClickProperty);
::CFRelease(scrollToClickProperty);
}
}
break;
default:
aMetric = 0;
res = NS_ERROR_FAILURE;

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

@ -108,6 +108,8 @@ nsLookAndFeelIntPref nsXPLookAndFeel::sIntPrefs[] =
eMetric_TabFocusModel, PR_FALSE, nsLookAndFeelTypeInt, 0 },
{ "ui.alertNotificationOrigin",
eMetric_AlertNotificationOrigin, PR_FALSE, nsLookAndFeelTypeInt, 0 },
{ "ui.scrollToClick",
eMetric_ScrollToClick, PR_FALSE, nsLookAndFeelTypeInt, 0 },
};
nsLookAndFeelFloatPref nsXPLookAndFeel::sFloatPrefs[] =