2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2015-06-12 15:49:57 +03: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/. */
|
|
|
|
|
|
|
|
#import <UIKit/UIColor.h>
|
|
|
|
#import <UIKit/UIInterface.h>
|
|
|
|
|
|
|
|
#include "nsLookAndFeel.h"
|
2018-04-13 22:34:37 +03:00
|
|
|
|
|
|
|
#include "mozilla/FontPropertyTypes.h"
|
2015-06-12 15:49:57 +03:00
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "gfxFont.h"
|
|
|
|
#include "gfxFontConstants.h"
|
|
|
|
|
|
|
|
nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel(), mInitialized(false) {}
|
|
|
|
|
|
|
|
nsLookAndFeel::~nsLookAndFeel() {}
|
|
|
|
|
|
|
|
static nscolor GetColorFromUIColor(UIColor* aColor) {
|
|
|
|
CGColorRef cgColor = [aColor CGColor];
|
|
|
|
CGColorSpaceModel model = CGColorSpaceGetModel(CGColorGetColorSpace(cgColor));
|
|
|
|
const CGFloat* components = CGColorGetComponents(cgColor);
|
|
|
|
if (model == kCGColorSpaceModelRGB) {
|
|
|
|
return NS_RGB((unsigned int)(components[0] * 255.0), (unsigned int)(components[1] * 255.0),
|
|
|
|
(unsigned int)(components[2] * 255.0));
|
|
|
|
} else if (model == kCGColorSpaceModelMonochrome) {
|
|
|
|
unsigned int val = (unsigned int)(components[0] * 255.0);
|
|
|
|
return NS_RGBA(val, val, val, (unsigned int)(components[1] * 255.0));
|
|
|
|
}
|
2018-06-18 08:43:11 +03:00
|
|
|
MOZ_ASSERT_UNREACHABLE("Unhandled color space!");
|
2015-06-12 15:49:57 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-10-10 23:50:58 +03:00
|
|
|
void nsLookAndFeel::NativeInit() { EnsureInit(); }
|
|
|
|
|
|
|
|
void nsLookAndFeel::RefreshImpl() {
|
|
|
|
nsXPLookAndFeel::RefreshImpl();
|
|
|
|
|
|
|
|
mInitialized = false;
|
|
|
|
}
|
|
|
|
|
2015-06-12 15:49:57 +03:00
|
|
|
nsresult nsLookAndFeel::NativeGetColor(const ColorID aID, nscolor& aResult) {
|
2017-10-10 23:50:58 +03:00
|
|
|
EnsureInit();
|
|
|
|
|
2015-06-12 15:49:57 +03:00
|
|
|
nsresult res = NS_OK;
|
|
|
|
|
|
|
|
switch (aID) {
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::WindowBackground:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xff, 0xff, 0xff);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::WindowForeground:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0x00, 0x00, 0x00);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::WidgetBackground:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xdd, 0xdd, 0xdd);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::WidgetForeground:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0x00, 0x00, 0x00);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::WidgetSelectBackground:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0x80, 0x80, 0x80);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::WidgetSelectForeground:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0x00, 0x00, 0x80);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Widget3DHighlight:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xa0, 0xa0, 0xa0);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Widget3DShadow:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0x40, 0x40, 0x40);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::TextBackground:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xff, 0xff, 0xff);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::TextForeground:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0x00, 0x00, 0x00);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::TextSelectBackground:
|
|
|
|
case ColorID::Highlight: // CSS2 color
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::MozMenuhover:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xee, 0xee, 0xee);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::TextSelectForeground:
|
|
|
|
case ColorID::Highlighttext: // CSS2 color
|
|
|
|
case ColorID::MozMenuhovertext:
|
2017-10-10 23:50:58 +03:00
|
|
|
aResult = mColorTextSelectForeground;
|
2015-06-12 15:49:57 +03:00
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::IMESelectedRawTextBackground:
|
|
|
|
case ColorID::IMESelectedConvertedTextBackground:
|
|
|
|
case ColorID::IMERawInputBackground:
|
|
|
|
case ColorID::IMEConvertedTextBackground:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_TRANSPARENT;
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::IMESelectedRawTextForeground:
|
|
|
|
case ColorID::IMESelectedConvertedTextForeground:
|
|
|
|
case ColorID::IMERawInputForeground:
|
|
|
|
case ColorID::IMEConvertedTextForeground:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_SAME_AS_FOREGROUND_COLOR;
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::IMERawInputUnderline:
|
|
|
|
case ColorID::IMEConvertedTextUnderline:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_40PERCENT_FOREGROUND_COLOR;
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::IMESelectedRawTextUnderline:
|
|
|
|
case ColorID::IMESelectedConvertedTextUnderline:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_SAME_AS_FOREGROUND_COLOR;
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::SpellCheckerUnderline:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xff, 0, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
//
|
|
|
|
// css2 system colors http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
|
|
|
|
//
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Buttontext:
|
|
|
|
case ColorID::MozButtonhovertext:
|
|
|
|
case ColorID::Captiontext:
|
|
|
|
case ColorID::Menutext:
|
|
|
|
case ColorID::Infotext:
|
|
|
|
case ColorID::MozMenubartext:
|
|
|
|
case ColorID::Windowtext:
|
2017-10-10 23:50:58 +03:00
|
|
|
aResult = mColorDarkText;
|
2015-06-12 15:49:57 +03:00
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Activecaption:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xff, 0xff, 0xff);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Activeborder:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0x00, 0x00, 0x00);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Appworkspace:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xFF, 0xFF, 0xFF);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Background:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0x63, 0x63, 0xCE);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Buttonface:
|
|
|
|
case ColorID::MozButtonhoverface:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xF0, 0xF0, 0xF0);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Buttonhighlight:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xFF, 0xFF, 0xFF);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Buttonshadow:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xDC, 0xDC, 0xDC);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Graytext:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0x44, 0x44, 0x44);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Inactiveborder:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xff, 0xff, 0xff);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Inactivecaption:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Inactivecaptiontext:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0x45, 0x45, 0x45);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Scrollbar:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0, 0, 0); // XXX
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Threeddarkshadow:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xDC, 0xDC, 0xDC);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Threedshadow:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xE0, 0xE0, 0xE0);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Threedface:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xF0, 0xF0, 0xF0);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Threedhighlight:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xff, 0xff, 0xff);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Threedlightshadow:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xDA, 0xDA, 0xDA);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Menu:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xff, 0xff, 0xff);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Infobackground:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xFF, 0xFF, 0xC7);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Windowframe:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::Window:
|
|
|
|
case ColorID::MozField:
|
|
|
|
case ColorID::MozCombobox:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xff, 0xff, 0xff);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::MozFieldtext:
|
|
|
|
case ColorID::MozComboboxtext:
|
2017-10-10 23:50:58 +03:00
|
|
|
aResult = mColorDarkText;
|
2015-06-12 15:49:57 +03:00
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::MozDialog:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::MozDialogtext:
|
|
|
|
case ColorID::MozCellhighlighttext:
|
|
|
|
case ColorID::MozHtmlCellhighlighttext:
|
2020-06-03 23:52:55 +03:00
|
|
|
case ColorID::MozColheadertext:
|
|
|
|
case ColorID::MozColheaderhovertext:
|
2017-10-10 23:50:58 +03:00
|
|
|
aResult = mColorDarkText;
|
2015-06-12 15:49:57 +03:00
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::MozDragtargetzone:
|
|
|
|
case ColorID::MozMacChromeActive:
|
|
|
|
case ColorID::MozMacChromeInactive:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::MozMacFocusring:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0x3F, 0x98, 0xDD);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::MozMacMenushadow:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xA3, 0xA3, 0xA3);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::MozMacMenutextdisable:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0x88, 0x88, 0x88);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::MozMacMenutextselect:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::MozMacDisabledtoolbartext:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0x3F, 0x3F, 0x3F);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::MozMacMenuselect:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::MozButtondefault:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_RGB(0xDC, 0xDC, 0xDC);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::MozCellhighlight:
|
|
|
|
case ColorID::MozHtmlCellhighlight:
|
|
|
|
case ColorID::MozMacSecondaryhighlight:
|
2015-06-12 15:49:57 +03:00
|
|
|
// For inactive list selection
|
|
|
|
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::MozEventreerow:
|
2015-06-12 15:49:57 +03:00
|
|
|
// Background color of even list rows.
|
|
|
|
aResult = NS_RGB(0xff, 0xff, 0xff);
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::MozOddtreerow:
|
2015-06-12 15:49:57 +03:00
|
|
|
// Background color of odd list rows.
|
|
|
|
aResult = NS_TRANSPARENT;
|
|
|
|
break;
|
2019-05-26 16:10:00 +03:00
|
|
|
case ColorID::MozNativehyperlinktext:
|
2015-06-12 15:49:57 +03:00
|
|
|
// There appears to be no available system defined color. HARDCODING to the appropriate color.
|
|
|
|
aResult = NS_RGB(0x14, 0x4F, 0xAE);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_WARNING("Someone asked nsILookAndFeel for a color I don't know about");
|
|
|
|
aResult = NS_RGB(0xff, 0xff, 0xff);
|
|
|
|
res = NS_ERROR_FAILURE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsLookAndFeel::GetIntImpl(IntID aID, int32_t& aResult) {
|
|
|
|
nsresult res = nsXPLookAndFeel::GetIntImpl(aID, aResult);
|
|
|
|
if (NS_SUCCEEDED(res)) return res;
|
|
|
|
res = NS_OK;
|
|
|
|
|
|
|
|
switch (aID) {
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::CaretBlinkTime:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 567;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::CaretWidth:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 1;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::ShowCaretDuringSelection:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 0;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::SelectTextfieldsOnKeyFocus:
|
2015-06-12 15:49:57 +03:00
|
|
|
// Select textfield content when focused by kbd
|
|
|
|
// used by nsEventStateManager::sTextfieldSelectModel
|
|
|
|
aResult = 1;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::SubmenuDelay:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 200;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::MenusCanOverlapOSBar:
|
2015-06-12 15:49:57 +03:00
|
|
|
// xul popups are not allowed to overlap the menubar.
|
|
|
|
aResult = 0;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::SkipNavigatingDisabledMenuItem:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 1;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::DragThresholdX:
|
|
|
|
case IntID::DragThresholdY:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 4;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::ScrollArrowStyle:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = eScrollArrow_None;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::ScrollSliderStyle:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = eScrollThumbStyle_Proportional;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::TreeOpenDelay:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 1000;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::TreeCloseDelay:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 1000;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::TreeLazyScrollDelay:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 150;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::TreeScrollDelay:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 100;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::TreeScrollLinesMax:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 3;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::DWMCompositor:
|
|
|
|
case IntID::WindowsClassic:
|
|
|
|
case IntID::WindowsDefaultTheme:
|
|
|
|
case IntID::TouchEnabled:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 0;
|
|
|
|
res = NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::MacGraphiteTheme:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 0;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::TabFocusModel:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 1; // default to just textboxes
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::ScrollToClick:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 0;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::ChosenMenuItemsShouldBlink:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 1;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::IMERawInputUnderlineStyle:
|
|
|
|
case IntID::IMEConvertedTextUnderlineStyle:
|
|
|
|
case IntID::IMESelectedRawTextUnderlineStyle:
|
|
|
|
case IntID::IMESelectedConvertedTextUnderline:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_STYLE_TEXT_DECORATION_STYLE_SOLID;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::SpellCheckerUnderlineStyle:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = NS_STYLE_TEXT_DECORATION_STYLE_DOTTED;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case IntID::ContextMenuOffsetVertical:
|
|
|
|
case IntID::ContextMenuOffsetHorizontal:
|
2015-08-04 23:41:00 +03:00
|
|
|
aResult = 2;
|
|
|
|
break;
|
2015-06-12 15:49:57 +03:00
|
|
|
default:
|
|
|
|
aResult = 0;
|
|
|
|
res = NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsLookAndFeel::GetFloatImpl(FloatID aID, float& aResult) {
|
|
|
|
nsresult res = nsXPLookAndFeel::GetFloatImpl(aID, aResult);
|
|
|
|
if (NS_SUCCEEDED(res)) return res;
|
|
|
|
res = NS_OK;
|
|
|
|
|
|
|
|
switch (aID) {
|
2020-06-11 14:27:43 +03:00
|
|
|
case FloatID::IMEUnderlineRelativeSize:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 2.0f;
|
|
|
|
break;
|
2020-06-11 14:27:43 +03:00
|
|
|
case FloatID::SpellCheckerUnderlineRelativeSize:
|
2015-06-12 15:49:57 +03:00
|
|
|
aResult = 2.0f;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
aResult = -1.0;
|
|
|
|
res = NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2019-02-08 16:22:11 +03:00
|
|
|
bool nsLookAndFeel::GetFontImpl(FontID aID, nsString& aFontName, gfxFontStyle& aFontStyle) {
|
2015-06-12 15:49:57 +03:00
|
|
|
// hack for now
|
2020-06-11 14:27:58 +03:00
|
|
|
if (aID == FontID::Window || aID == FontID::Document) {
|
2018-04-23 17:52:20 +03:00
|
|
|
aFontStyle.style = FontSlantStyle::Normal();
|
2018-04-13 22:34:37 +03:00
|
|
|
aFontStyle.weight = FontWeight::Normal();
|
2018-04-23 17:52:20 +03:00
|
|
|
aFontStyle.stretch = FontStretch::Normal();
|
2019-02-08 16:22:11 +03:00
|
|
|
aFontStyle.size = 14;
|
2015-06-12 15:49:57 +03:00
|
|
|
aFontStyle.systemFont = true;
|
|
|
|
|
|
|
|
aFontName.AssignLiteral("sans-serif");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: implement more here?
|
|
|
|
return false;
|
|
|
|
}
|
2017-10-10 23:50:58 +03:00
|
|
|
|
|
|
|
void nsLookAndFeel::EnsureInit() {
|
|
|
|
if (mInitialized) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
mInitialized = true;
|
|
|
|
|
|
|
|
nscolor color;
|
2019-05-26 16:10:00 +03:00
|
|
|
GetColor(ColorID::TextSelectBackground, color);
|
2017-10-10 23:50:58 +03:00
|
|
|
if (color == 0x000000) {
|
|
|
|
mColorTextSelectForeground = NS_RGB(0xff, 0xff, 0xff);
|
|
|
|
} else {
|
|
|
|
mColorTextSelectForeground = NS_DONT_CHANGE_COLOR;
|
|
|
|
}
|
|
|
|
|
|
|
|
mColorDarkText = GetColorFromUIColor([UIColor darkTextColor]);
|
2019-12-20 22:05:12 +03:00
|
|
|
|
|
|
|
RecordTelemetry();
|
2017-10-10 23:50:58 +03:00
|
|
|
}
|