Bug 936628: Add media query to check for whether we have a color picker backend available. r=jimm

This commit is contained in:
Daniel Holbert 2013-11-10 19:07:59 -08:00
Родитель 6db16af142
Коммит e846bd6bb3
7 изменённых файлов: 33 добавлений и 0 удалений

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

@ -2001,6 +2001,7 @@ GK_ATOM(DisplayPort, "_displayport")
GK_ATOM(CriticalDisplayPort, "_critical_displayport")
// Names for system metrics
GK_ATOM(color_picker_available, "color-picker-available")
GK_ATOM(scrollbar_start_backward, "scrollbar-start-backward")
GK_ATOM(scrollbar_start_forward, "scrollbar-start-forward")
GK_ATOM(scrollbar_end_backward, "scrollbar-end-backward")
@ -2038,6 +2039,7 @@ GK_ATOM(windows_version_win7, "windows-version-win7")
GK_ATOM(windows_version_win8, "windows-version-win8")
// And the same again, as media query keywords.
GK_ATOM(_moz_color_picker_available, "-moz-color-picker-available")
GK_ATOM(_moz_scrollbar_start_backward, "-moz-scrollbar-start-backward")
GK_ATOM(_moz_scrollbar_start_forward, "-moz-scrollbar-start-forward")
GK_ATOM(_moz_scrollbar_end_backward, "-moz-scrollbar-end-backward")

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

@ -1168,6 +1168,11 @@ InitSystemMetrics()
sSystemMetrics->AppendElement(nsGkAtoms::windows_glass);
}
rv = LookAndFeel::GetInt(LookAndFeel::eIntID_ColorPickerAvailable, &metricResult);
if (NS_SUCCEEDED(rv) && metricResult) {
sSystemMetrics->AppendElement(nsGkAtoms::color_picker_available);
}
rv = LookAndFeel::GetInt(LookAndFeel::eIntID_WindowsClassic, &metricResult);
if (NS_SUCCEEDED(rv) && metricResult) {
sSystemMetrics->AppendElement(nsGkAtoms::windows_classic);

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

@ -495,6 +495,13 @@ nsMediaFeatures::features[] = {
{ nullptr },
GetIsResourceDocument
},
{
&nsGkAtoms::_moz_color_picker_available,
nsMediaFeature::eMinMaxNotAllowed,
nsMediaFeature::eBoolInteger,
{ &nsGkAtoms::color_picker_available },
GetSystemMetric
},
{
&nsGkAtoms::_moz_scrollbar_start_backward,
nsMediaFeature::eMinMaxNotAllowed,

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

@ -356,6 +356,15 @@ public:
*/
eIntID_SwipeAnimationEnabled,
/*
* A Boolean value to determine whether we have a color picker available
* for <input type="color"> to hook into.
*
* This lets us selectively enable the style for <input type="color">
* based on whether it's functional or not.
*/
eIntID_ColorPickerAvailable,
/*
* A boolean value indicating whether or not the device has a hardware
* home button. Used on gaia to determine whether a home button

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

@ -446,6 +446,9 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
aResult = [NSEvent isSwipeTrackingFromScrollEventsEnabled] ? 1 : 0;
}
break;
case eIntID_ColorPickerAvailable:
aResult = 1;
break;
default:
aResult = 0;
res = NS_ERROR_FAILURE;

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

@ -663,6 +663,9 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
case eIntID_SwipeAnimationEnabled:
aResult = 0;
break;
case eIntID_ColorPickerAvailable:
aResult = 1;
break;
default:
aResult = 0;
res = NS_ERROR_FAILURE;

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

@ -482,6 +482,10 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
case eIntID_SwipeAnimationEnabled:
aResult = 0;
break;
case eIntID_ColorPickerAvailable:
// We don't have a color picker implemented on Metro yet (bug 895464)
aResult = (XRE_GetWindowsEnvironment() != WindowsEnvironmentType_Metro);
break;
case eIntID_UseOverlayScrollbars:
aResult = (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro);
break;