Backed out changeset 04439a161b82 (bug 1403690)

This commit is contained in:
Sebastian Hengst 2017-10-23 22:04:54 +02:00
Родитель 91ab85da63
Коммит 94a3c53cb0
2 изменённых файлов: 9 добавлений и 50 удалений

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

@ -14,9 +14,8 @@ public:
nsLookAndFeel();
virtual ~nsLookAndFeel();
virtual void NativeInit() final;
virtual void RefreshImpl();
virtual nsresult NativeGetColor(const ColorID aID, nscolor &aResult);
virtual void NativeInit() final {};
virtual nsresult GetIntImpl(IntID aID, int32_t &aResult);
virtual nsresult GetFloatImpl(FloatID aID, float &aResult);
virtual bool GetFontImpl(FontID aID, nsString& aFontName,
@ -32,14 +31,6 @@ public:
{
return true;
}
private:
nscolor mColorTextSelectForeground;
nscolor mColorDarkText;
bool mInitialized;
void EnsureInit();
};
#endif

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

@ -13,7 +13,6 @@
nsLookAndFeel::nsLookAndFeel()
: nsXPLookAndFeel()
, mInitialized(false)
{
}
@ -40,25 +39,9 @@ static nscolor GetColorFromUIColor(UIColor* aColor)
return 0;
}
void
nsLookAndFeel::NativeInit()
{
EnsureInit();
}
void
nsLookAndFeel::RefreshImpl()
{
nsXPLookAndFeel::RefreshImpl();
mInitialized = false;
}
nsresult
nsLookAndFeel::NativeGetColor(const ColorID aID, nscolor &aResult)
{
EnsureInit();
nsresult res = NS_OK;
switch (aID) {
@ -102,7 +85,11 @@ nsLookAndFeel::NativeGetColor(const ColorID aID, nscolor &aResult)
case eColorID_TextSelectForeground:
case eColorID_highlighttext: // CSS2 color
case eColorID__moz_menuhovertext:
aResult = mColorTextSelectForeground;
GetColor(eColorID_TextSelectBackground, aResult);
if (aResult == 0x000000)
aResult = NS_RGB(0xff,0xff,0xff);
else
aResult = NS_DONT_CHANGE_COLOR;
break;
case eColorID_IMESelectedRawTextBackground:
case eColorID_IMESelectedConvertedTextBackground:
@ -138,7 +125,7 @@ nsLookAndFeel::NativeGetColor(const ColorID aID, nscolor &aResult)
case eColorID_infotext:
case eColorID__moz_menubartext:
case eColorID_windowtext:
aResult = mColorDarkText;
aResult = GetColorFromUIColor([UIColor darkTextColor]);
break;
case eColorID_activecaption:
aResult = NS_RGB(0xff,0xff,0xff);
@ -208,7 +195,7 @@ nsLookAndFeel::NativeGetColor(const ColorID aID, nscolor &aResult)
break;
case eColorID__moz_fieldtext:
case eColorID__moz_comboboxtext:
aResult = mColorDarkText;
aResult = GetColorFromUIColor([UIColor darkTextColor]);
break;
case eColorID__moz_dialog:
aResult = NS_RGB(0xaa,0xaa,0xaa);
@ -216,7 +203,7 @@ nsLookAndFeel::NativeGetColor(const ColorID aID, nscolor &aResult)
case eColorID__moz_dialogtext:
case eColorID__moz_cellhighlighttext:
case eColorID__moz_html_cellhighlighttext:
aResult = mColorDarkText;
aResult = GetColorFromUIColor([UIColor darkTextColor]);
break;
case eColorID__moz_dragtargetzone:
case eColorID__moz_mac_chrome_active:
@ -412,22 +399,3 @@ nsLookAndFeel::GetFontImpl(FontID aID, nsString &aFontName,
//TODO: implement more here?
return false;
}
void
nsLookAndFeel::EnsureInit()
{
if (mInitialized) {
return;
}
mInitialized = true;
nscolor color;
GetColor(eColorID_TextSelectBackground, color);
if (color == 0x000000) {
mColorTextSelectForeground = NS_RGB(0xff,0xff,0xff);
} else {
mColorTextSelectForeground = NS_DONT_CHANGE_COLOR;
}
mColorDarkText = GetColorFromUIColor([UIColor darkTextColor]);
}