2010-06-03 13:56:36 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-06-03 13:56:36 -07:00
|
|
|
|
2011-03-30 11:04:41 -07:00
|
|
|
#include "mozilla/dom/ContentChild.h"
|
2011-03-31 05:26:49 -07:00
|
|
|
#include "nsStyleConsts.h"
|
2011-03-30 11:04:41 -07:00
|
|
|
#include "nsXULAppAPI.h"
|
|
|
|
#include "nsLookAndFeel.h"
|
2012-02-20 15:19:48 -08:00
|
|
|
#include "gfxFont.h"
|
2011-03-30 11:04:41 -07:00
|
|
|
|
|
|
|
using namespace mozilla;
|
|
|
|
using mozilla::dom::ContentChild;
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool nsLookAndFeel::mInitializedSystemColors = false;
|
2011-03-30 11:04:41 -07:00
|
|
|
AndroidSystemColors nsLookAndFeel::mSystemColors;
|
2010-06-03 13:56:36 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool nsLookAndFeel::mInitializedShowPassword = false;
|
|
|
|
bool nsLookAndFeel::mShowPassword = true;
|
2011-07-26 18:14:52 -07:00
|
|
|
|
2012-08-06 22:13:25 -07:00
|
|
|
static const PRUnichar UNICODE_BULLET = 0x2022;
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
nsLookAndFeel::nsLookAndFeel()
|
|
|
|
: nsXPLookAndFeel()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsLookAndFeel::~nsLookAndFeel()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-03-30 11:04:41 -07:00
|
|
|
#define BG_PRELIGHT_COLOR NS_RGB(0xee,0xee,0xee)
|
|
|
|
#define FG_PRELIGHT_COLOR NS_RGB(0x77,0x77,0x77)
|
|
|
|
#define BLACK_COLOR NS_RGB(0x00,0x00,0x00)
|
|
|
|
#define DARK_GRAY_COLOR NS_RGB(0x40,0x40,0x40)
|
|
|
|
#define GRAY_COLOR NS_RGB(0x80,0x80,0x80)
|
|
|
|
#define LIGHT_GRAY_COLOR NS_RGB(0xa0,0xa0,0xa0)
|
|
|
|
#define RED_COLOR NS_RGB(0xff,0x00,0x00)
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsLookAndFeel::GetSystemColors()
|
|
|
|
{
|
2011-07-26 18:14:52 -07:00
|
|
|
if (mInitializedSystemColors)
|
2011-03-30 11:04:41 -07:00
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
if (!AndroidBridge::Bridge())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
AndroidBridge::Bridge()->GetSystemColors(&mSystemColors);
|
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
mInitializedSystemColors = true;
|
2011-03-30 11:04:41 -07:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsLookAndFeel::CallRemoteGetSystemColors()
|
|
|
|
{
|
|
|
|
// An array has to be used to get data from remote process
|
2012-08-22 08:56:38 -07:00
|
|
|
InfallibleTArray<uint32_t> colors;
|
|
|
|
uint32_t colorsCount = sizeof(AndroidSystemColors) / sizeof(nscolor);
|
2011-03-30 11:04:41 -07:00
|
|
|
|
|
|
|
if (!ContentChild::GetSingleton()->SendGetSystemColors(colorsCount, &colors))
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
NS_ASSERTION(colors.Length() == colorsCount, "System colors array is incomplete");
|
|
|
|
if (colors.Length() == 0)
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
if (colors.Length() < colorsCount)
|
|
|
|
colorsCount = colors.Length();
|
|
|
|
|
|
|
|
// Array elements correspond to the members of mSystemColors structure,
|
|
|
|
// so just copy the memory block
|
|
|
|
memcpy(&mSystemColors, colors.Elements(), sizeof(nscolor) * colorsCount);
|
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
mInitializedSystemColors = true;
|
2011-03-30 11:04:41 -07:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
nsresult
|
2011-09-08 19:27:13 -07:00
|
|
|
nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
|
2010-06-03 13:56:36 -07:00
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
2011-07-26 18:14:52 -07:00
|
|
|
if (!mInitializedSystemColors) {
|
2011-03-30 11:04:41 -07:00
|
|
|
if (XRE_GetProcessType() == GeckoProcessType_Default)
|
|
|
|
rv = GetSystemColors();
|
|
|
|
else
|
|
|
|
rv = CallRemoteGetSystemColors();
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
}
|
2010-06-03 13:56:36 -07:00
|
|
|
|
|
|
|
// XXX we'll want to use context.obtainStyledAttributes on the java side to
|
|
|
|
// get all of these; see TextView.java for a good exmaple.
|
|
|
|
|
|
|
|
switch (aID) {
|
|
|
|
// These colors don't seem to be used for anything anymore in Mozilla
|
|
|
|
// (except here at least TextSelectBackground and TextSelectForeground)
|
|
|
|
// The CSS2 colors below are used.
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_WindowBackground:
|
2012-08-28 22:48:43 -07:00
|
|
|
aColor = NS_RGB(0xFF, 0xFF, 0xFF);
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_WindowForeground:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.textColorPrimary;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_WidgetBackground:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_WidgetForeground:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorForeground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_WidgetSelectBackground:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.textColorHighlight;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_WidgetSelectForeground:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.textColorPrimaryInverse;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_Widget3DHighlight:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = LIGHT_GRAY_COLOR;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_Widget3DShadow:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = DARK_GRAY_COLOR;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_TextBackground:
|
2010-06-03 13:56:36 -07:00
|
|
|
// not used?
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_TextForeground:
|
2010-06-03 13:56:36 -07:00
|
|
|
// not used?
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.textColorPrimary;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_TextSelectBackground:
|
|
|
|
case eColorID_IMESelectedRawTextBackground:
|
|
|
|
case eColorID_IMESelectedConvertedTextBackground:
|
2010-06-03 13:56:36 -07:00
|
|
|
// still used
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.textColorHighlight;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_TextSelectForeground:
|
|
|
|
case eColorID_IMESelectedRawTextForeground:
|
|
|
|
case eColorID_IMESelectedConvertedTextForeground:
|
2010-06-03 13:56:36 -07:00
|
|
|
// still used
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.textColorPrimaryInverse;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_IMERawInputBackground:
|
|
|
|
case eColorID_IMEConvertedTextBackground:
|
2010-06-03 13:56:36 -07:00
|
|
|
aColor = NS_TRANSPARENT;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_IMERawInputForeground:
|
|
|
|
case eColorID_IMEConvertedTextForeground:
|
2010-06-03 13:56:36 -07:00
|
|
|
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_IMERawInputUnderline:
|
|
|
|
case eColorID_IMEConvertedTextUnderline:
|
2010-06-03 13:56:36 -07:00
|
|
|
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_IMESelectedRawTextUnderline:
|
|
|
|
case eColorID_IMESelectedConvertedTextUnderline:
|
2010-06-03 13:56:36 -07:00
|
|
|
aColor = NS_TRANSPARENT;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_SpellCheckerUnderline:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = RED_COLOR;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
// css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_activeborder:
|
2010-06-03 13:56:36 -07:00
|
|
|
// active window border
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_activecaption:
|
2010-06-03 13:56:36 -07:00
|
|
|
// active window caption background
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_appworkspace:
|
2010-06-03 13:56:36 -07:00
|
|
|
// MDI background color
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_background:
|
2010-06-03 13:56:36 -07:00
|
|
|
// desktop background
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_captiontext:
|
2010-06-03 13:56:36 -07:00
|
|
|
// text in active window caption, size box, and scrollbar arrow box (!)
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorForeground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_graytext:
|
2010-06-03 13:56:36 -07:00
|
|
|
// disabled text in windows, menus, etc.
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.textColorTertiary;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_highlight:
|
2010-06-03 13:56:36 -07:00
|
|
|
// background of selected item
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.textColorHighlight;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_highlighttext:
|
2010-06-03 13:56:36 -07:00
|
|
|
// text of selected item
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.textColorPrimaryInverse;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_inactiveborder:
|
2010-06-03 13:56:36 -07:00
|
|
|
// inactive window border
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_inactivecaption:
|
2010-06-03 13:56:36 -07:00
|
|
|
// inactive window caption
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_inactivecaptiontext:
|
2010-06-03 13:56:36 -07:00
|
|
|
// text in inactive window caption
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.textColorTertiary;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_infobackground:
|
2010-06-03 13:56:36 -07:00
|
|
|
// tooltip background color
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_infotext:
|
2010-06-03 13:56:36 -07:00
|
|
|
// tooltip text color
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorForeground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_menu:
|
2010-06-03 13:56:36 -07:00
|
|
|
// menu background
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_menutext:
|
2010-06-03 13:56:36 -07:00
|
|
|
// menu text
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorForeground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_scrollbar:
|
2010-06-03 13:56:36 -07:00
|
|
|
// scrollbar gray area
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_threedface:
|
|
|
|
case eColorID_buttonface:
|
2010-06-03 13:56:36 -07:00
|
|
|
// 3-D face color
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_buttontext:
|
2010-06-03 13:56:36 -07:00
|
|
|
// text on push buttons
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorForeground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_buttonhighlight:
|
2010-06-03 13:56:36 -07:00
|
|
|
// 3-D highlighted edge color
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_threedhighlight:
|
2010-06-03 13:56:36 -07:00
|
|
|
// 3-D highlighted outer edge color
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = LIGHT_GRAY_COLOR;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_threedlightshadow:
|
2010-06-03 13:56:36 -07:00
|
|
|
// 3-D highlighted inner edge color
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_buttonshadow:
|
2010-06-03 13:56:36 -07:00
|
|
|
// 3-D shadow edge color
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_threedshadow:
|
2010-06-03 13:56:36 -07:00
|
|
|
// 3-D shadow inner edge color
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = GRAY_COLOR;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_threeddarkshadow:
|
2010-06-03 13:56:36 -07:00
|
|
|
// 3-D shadow outer edge color
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = BLACK_COLOR;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_window:
|
|
|
|
case eColorID_windowframe:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_windowtext:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.textColorPrimary;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_eventreerow:
|
|
|
|
case eColorID__moz_field:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_fieldtext:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.textColorPrimary;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_dialog:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_dialogtext:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorForeground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_dragtargetzone:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.textColorHighlight;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_buttondefault:
|
2010-06-03 13:56:36 -07:00
|
|
|
// default button border color
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = BLACK_COLOR;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_buttonhoverface:
|
2010-06-03 13:56:36 -07:00
|
|
|
aColor = BG_PRELIGHT_COLOR;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_buttonhovertext:
|
2010-06-03 13:56:36 -07:00
|
|
|
aColor = FG_PRELIGHT_COLOR;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_cellhighlight:
|
|
|
|
case eColorID__moz_html_cellhighlight:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.textColorHighlight;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_cellhighlighttext:
|
|
|
|
case eColorID__moz_html_cellhighlighttext:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.textColorPrimaryInverse;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_menuhover:
|
2010-06-03 13:56:36 -07:00
|
|
|
aColor = BG_PRELIGHT_COLOR;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_menuhovertext:
|
2010-06-03 13:56:36 -07:00
|
|
|
aColor = FG_PRELIGHT_COLOR;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_oddtreerow:
|
2010-06-03 13:56:36 -07:00
|
|
|
aColor = NS_TRANSPARENT;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_nativehyperlinktext:
|
2010-06-03 13:56:36 -07:00
|
|
|
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_comboboxtext:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorForeground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_combobox:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorBackground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_menubartext:
|
2011-03-30 11:04:41 -07:00
|
|
|
aColor = mSystemColors.colorForeground;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_menubarhovertext:
|
2010-06-03 13:56:36 -07:00
|
|
|
aColor = FG_PRELIGHT_COLOR;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* default color is BLACK */
|
|
|
|
aColor = 0;
|
|
|
|
rv = NS_ERROR_FAILURE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
nsresult
|
2012-08-22 08:56:38 -07:00
|
|
|
nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
|
2010-06-03 13:56:36 -07:00
|
|
|
{
|
2011-09-08 19:27:13 -07:00
|
|
|
nsresult rv = nsXPLookAndFeel::GetIntImpl(aID, aResult);
|
2010-06-03 13:56:36 -07:00
|
|
|
if (NS_SUCCEEDED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
rv = NS_OK;
|
|
|
|
|
|
|
|
switch (aID) {
|
2011-09-08 19:27:13 -07:00
|
|
|
case eIntID_CaretBlinkTime:
|
|
|
|
aResult = 500;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eIntID_CaretWidth:
|
|
|
|
aResult = 1;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eIntID_ShowCaretDuringSelection:
|
|
|
|
aResult = 0;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eIntID_SelectTextfieldsOnKeyFocus:
|
2010-06-03 13:56:36 -07:00
|
|
|
// Select textfield content when focused by kbd
|
|
|
|
// used by nsEventStateManager::sTextfieldSelectModel
|
2011-09-08 19:27:13 -07:00
|
|
|
aResult = 1;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eIntID_SubmenuDelay:
|
|
|
|
aResult = 200;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-12-16 01:18:48 -08:00
|
|
|
case eIntID_TooltipDelay:
|
|
|
|
aResult = 500;
|
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eIntID_MenusCanOverlapOSBar:
|
2010-06-03 13:56:36 -07:00
|
|
|
// we want XUL popups to be able to overlap the task bar.
|
2011-09-08 19:27:13 -07:00
|
|
|
aResult = 1;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eIntID_ScrollArrowStyle:
|
|
|
|
aResult = eScrollArrowStyle_Single;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eIntID_ScrollSliderStyle:
|
|
|
|
aResult = eScrollThumbStyle_Proportional;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eIntID_TouchEnabled:
|
2012-03-20 16:44:43 -07:00
|
|
|
aResult = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eIntID_WindowsDefaultTheme:
|
2011-09-08 19:27:13 -07:00
|
|
|
case eIntID_MaemoClassic:
|
|
|
|
case eIntID_WindowsThemeIdentifier:
|
|
|
|
aResult = 0;
|
2010-06-03 13:56:36 -07:00
|
|
|
rv = NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eIntID_SpellCheckerUnderlineStyle:
|
|
|
|
aResult = NS_STYLE_TEXT_DECORATION_STYLE_WAVY;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-11-17 15:41:35 -08:00
|
|
|
case eIntID_ScrollbarButtonAutoRepeatBehavior:
|
|
|
|
aResult = 0;
|
|
|
|
break;
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
default:
|
2011-09-08 19:27:13 -07:00
|
|
|
aResult = 0;
|
2010-06-03 13:56:36 -07:00
|
|
|
rv = NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
nsresult
|
|
|
|
nsLookAndFeel::GetFloatImpl(FloatID aID, float &aResult)
|
2010-06-03 13:56:36 -07:00
|
|
|
{
|
2011-09-08 19:27:13 -07:00
|
|
|
nsresult rv = nsXPLookAndFeel::GetFloatImpl(aID, aResult);
|
2010-06-03 13:56:36 -07:00
|
|
|
if (NS_SUCCEEDED(rv))
|
|
|
|
return rv;
|
|
|
|
rv = NS_OK;
|
|
|
|
|
|
|
|
switch (aID) {
|
2011-09-08 19:27:13 -07:00
|
|
|
case eFloatID_IMEUnderlineRelativeSize:
|
|
|
|
aResult = 1.0f;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eFloatID_SpellCheckerUnderlineRelativeSize:
|
|
|
|
aResult = 1.0f;
|
2010-06-03 13:56:36 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-09-08 19:27:13 -07:00
|
|
|
aResult = -1.0;
|
2010-06-03 13:56:36 -07:00
|
|
|
rv = NS_ERROR_FAILURE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
2011-07-26 18:14:52 -07:00
|
|
|
|
2012-02-20 15:19:48 -08:00
|
|
|
/*virtual*/
|
|
|
|
bool
|
|
|
|
nsLookAndFeel::GetFontImpl(FontID aID, nsString& aFontName,
|
2012-09-29 04:35:08 -07:00
|
|
|
gfxFontStyle& aFontStyle,
|
|
|
|
float aDevPixPerCSSPixel)
|
2012-02-20 15:19:48 -08:00
|
|
|
{
|
|
|
|
aFontName.AssignLiteral("\"Droid Sans\"");
|
|
|
|
aFontStyle.style = NS_FONT_STYLE_NORMAL;
|
|
|
|
aFontStyle.weight = NS_FONT_WEIGHT_NORMAL;
|
|
|
|
aFontStyle.stretch = NS_FONT_STRETCH_NORMAL;
|
|
|
|
aFontStyle.size = 9.0 * 96.0f / 72.0f;
|
|
|
|
aFontStyle.systemFont = true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-07-26 18:14:52 -07:00
|
|
|
/*virtual*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2011-09-08 19:27:13 -07:00
|
|
|
nsLookAndFeel::GetEchoPasswordImpl()
|
2011-07-26 18:14:52 -07:00
|
|
|
{
|
|
|
|
if (!mInitializedShowPassword) {
|
|
|
|
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
|
|
|
if (AndroidBridge::Bridge())
|
|
|
|
mShowPassword = AndroidBridge::Bridge()->GetShowPasswordSetting();
|
|
|
|
else
|
2012-07-30 07:20:58 -07:00
|
|
|
NS_ASSERTION(AndroidBridge::Bridge() != nullptr, "AndroidBridge is not available!");
|
2011-07-26 18:14:52 -07:00
|
|
|
} else {
|
|
|
|
ContentChild::GetSingleton()->SendGetShowPasswordSetting(&mShowPassword);
|
|
|
|
}
|
2011-10-17 07:59:28 -07:00
|
|
|
mInitializedShowPassword = true;
|
2011-07-26 18:14:52 -07:00
|
|
|
}
|
|
|
|
return mShowPassword;
|
|
|
|
}
|
2012-07-12 19:26:20 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t
|
2012-07-12 19:26:20 -07:00
|
|
|
nsLookAndFeel::GetPasswordMaskDelayImpl()
|
|
|
|
{
|
2012-08-06 22:13:25 -07:00
|
|
|
// This value is hard-coded in Android OS's PasswordTransformationMethod.java
|
2012-07-12 19:26:20 -07:00
|
|
|
return 1500;
|
|
|
|
}
|
2012-08-06 22:13:25 -07:00
|
|
|
|
|
|
|
/* virtual */
|
|
|
|
PRUnichar
|
|
|
|
nsLookAndFeel::GetPasswordCharacterImpl()
|
|
|
|
{
|
|
|
|
// This value is hard-coded in Android OS's PasswordTransformationMethod.java
|
|
|
|
return UNICODE_BULLET;
|
|
|
|
}
|