зеркало из https://github.com/mozilla/gecko-dev.git
disabled form elements don't have aqua appearance (bug 204237) r=josh sr=bryner
This commit is contained in:
Родитель
c46a5a1beb
Коммит
fc9818aae0
|
@ -98,6 +98,7 @@ nsNativeThemeMac::nsNativeThemeMac()
|
|||
sTextfieldBorderSize.right = sTextfieldBorderSize.bottom = 2;
|
||||
sTextfieldBGTransparent = PR_FALSE;
|
||||
sListboxBGTransparent = PR_TRUE;
|
||||
sTextfieldDisabledBGColorID = nsILookAndFeel::eColor__moz_field;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,10 +52,24 @@
|
|||
|
||||
nsMargin nsNativeTheme::sButtonBorderSize(2, 2, 2, 2);
|
||||
nsMargin nsNativeTheme::sButtonDisabledBorderSize(1, 1, 1, 1);
|
||||
PRUint8 nsNativeTheme::sButtonActiveBorderStyle = NS_STYLE_BORDER_STYLE_INSET;
|
||||
PRUint8 nsNativeTheme::sButtonInactiveBorderStyle = NS_STYLE_BORDER_STYLE_OUTSET;
|
||||
nsILookAndFeel::nsColorID nsNativeTheme::sButtonBorderColorID = nsILookAndFeel::eColor_threedface;
|
||||
nsILookAndFeel::nsColorID nsNativeTheme::sButtonDisabledBorderColorID = nsILookAndFeel::eColor_threedshadow;
|
||||
nsILookAndFeel::nsColorID nsNativeTheme::sButtonBGColorID = nsILookAndFeel::eColor_threedface;
|
||||
nsILookAndFeel::nsColorID nsNativeTheme::sButtonDisabledBGColorID = nsILookAndFeel::eColor_threedface;
|
||||
nsMargin nsNativeTheme::sTextfieldBorderSize(2, 2, 2, 2);
|
||||
PRUint8 nsNativeTheme::sTextfieldBorderStyle = NS_STYLE_BORDER_STYLE_INSET;
|
||||
nsILookAndFeel::nsColorID nsNativeTheme::sTextfieldBorderColorID = nsILookAndFeel::eColor_threedface;
|
||||
PRBool nsNativeTheme::sTextfieldBGTransparent = PR_FALSE;
|
||||
nsILookAndFeel::nsColorID nsNativeTheme::sTextfieldBGColorID = nsILookAndFeel::eColor__moz_field;
|
||||
nsILookAndFeel::nsColorID nsNativeTheme::sTextfieldDisabledBGColorID = nsILookAndFeel::eColor_threedface;
|
||||
nsMargin nsNativeTheme::sListboxBorderSize(2, 2, 2, 2);
|
||||
PRUint8 nsNativeTheme::sListboxBorderStyle = NS_STYLE_BORDER_STYLE_INSET;
|
||||
nsILookAndFeel::nsColorID nsNativeTheme::sListboxBorderColorID = nsILookAndFeel::eColor_threedface;
|
||||
PRBool nsNativeTheme::sListboxBGTransparent = PR_FALSE;
|
||||
nsILookAndFeel::nsColorID nsNativeTheme::sListboxBGColorID = nsILookAndFeel::eColor__moz_field;
|
||||
nsILookAndFeel::nsColorID nsNativeTheme::sListboxDisabledBGColorID = nsILookAndFeel::eColor_threedface;
|
||||
|
||||
nsNativeTheme::nsNativeTheme()
|
||||
{
|
||||
|
@ -216,50 +230,53 @@ nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext, nsIFrame* aFrame,
|
|||
case NS_THEME_BUTTON:
|
||||
if (IsDisabled(aFrame)) {
|
||||
ConvertMarginToTwips(sButtonDisabledBorderSize, defaultBorderSize, p2t);
|
||||
defaultBorderStyle = NS_STYLE_BORDER_STYLE_OUTSET;
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_threedshadow,
|
||||
defaultBorderStyle = sButtonInactiveBorderStyle;
|
||||
lookAndFeel->GetColor(sButtonDisabledBorderColorID,
|
||||
defaultBorderColor);
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_threedface,
|
||||
lookAndFeel->GetColor(sButtonDisabledBGColorID,
|
||||
defaultBGColor);
|
||||
} else {
|
||||
PRInt32 contentState = GetContentState(aFrame, aWidgetType);
|
||||
ConvertMarginToTwips(sButtonBorderSize, defaultBorderSize, p2t);
|
||||
if (contentState & NS_EVENT_STATE_HOVER &&
|
||||
contentState & NS_EVENT_STATE_ACTIVE)
|
||||
defaultBorderStyle = NS_STYLE_BORDER_STYLE_INSET;
|
||||
defaultBorderStyle = sButtonActiveBorderStyle;
|
||||
else
|
||||
defaultBorderStyle = NS_STYLE_BORDER_STYLE_OUTSET;
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_threedface,
|
||||
defaultBorderStyle = sButtonInactiveBorderStyle;
|
||||
lookAndFeel->GetColor(sButtonBorderColorID,
|
||||
defaultBorderColor);
|
||||
lookAndFeel->GetColor(sButtonBGColorID,
|
||||
defaultBorderColor);
|
||||
defaultBGColor = defaultBorderColor;
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_THEME_TEXTFIELD:
|
||||
defaultBorderStyle = NS_STYLE_BORDER_STYLE_INSET;
|
||||
defaultBorderStyle = sTextfieldBorderStyle;
|
||||
ConvertMarginToTwips(sTextfieldBorderSize, defaultBorderSize, p2t);
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_threedface,
|
||||
lookAndFeel->GetColor(sTextfieldBorderColorID,
|
||||
defaultBorderColor);
|
||||
if (!(defaultBGTransparent = sTextfieldBGTransparent)) {
|
||||
if (IsDisabled(aFrame))
|
||||
defaultBGColor = defaultBorderColor;
|
||||
lookAndFeel->GetColor(sTextfieldDisabledBGColorID,
|
||||
defaultBGColor);
|
||||
else
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor__moz_field,
|
||||
lookAndFeel->GetColor(sTextfieldBGColorID,
|
||||
defaultBGColor);
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_THEME_LISTBOX:
|
||||
case NS_THEME_DROPDOWN:
|
||||
defaultBorderStyle = NS_STYLE_BORDER_STYLE_INSET;
|
||||
defaultBorderStyle = sListboxBorderStyle;
|
||||
ConvertMarginToTwips(sListboxBorderSize, defaultBorderSize, p2t);
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_threedface,
|
||||
lookAndFeel->GetColor(sListboxBorderColorID,
|
||||
defaultBorderColor);
|
||||
if (!(defaultBGTransparent = sListboxBGTransparent)) {
|
||||
if (IsDisabled(aFrame))
|
||||
defaultBGColor = defaultBorderColor;
|
||||
lookAndFeel->GetColor(sListboxDisabledBGColorID,
|
||||
defaultBorderColor);
|
||||
else
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor__moz_field,
|
||||
lookAndFeel->GetColor(sListboxBGColorID,
|
||||
defaultBGColor);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsMargin.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIPresShell;
|
||||
|
@ -157,10 +158,24 @@ protected:
|
|||
// match the values in platform-forms.css. These defaults match forms.css
|
||||
static nsMargin sButtonBorderSize;
|
||||
static nsMargin sButtonDisabledBorderSize;
|
||||
static PRUint8 sButtonActiveBorderStyle;
|
||||
static PRUint8 sButtonInactiveBorderStyle;
|
||||
static nsILookAndFeel::nsColorID sButtonBorderColorID;
|
||||
static nsILookAndFeel::nsColorID sButtonDisabledBorderColorID;
|
||||
static nsILookAndFeel::nsColorID sButtonBGColorID;
|
||||
static nsILookAndFeel::nsColorID sButtonDisabledBGColorID;
|
||||
static nsMargin sTextfieldBorderSize;
|
||||
static PRUint8 sTextfieldBorderStyle;
|
||||
static nsILookAndFeel::nsColorID sTextfieldBorderColorID;
|
||||
static PRBool sTextfieldBGTransparent;
|
||||
static nsILookAndFeel::nsColorID sTextfieldBGColorID;
|
||||
static nsILookAndFeel::nsColorID sTextfieldDisabledBGColorID;
|
||||
static nsMargin sListboxBorderSize;
|
||||
static PRUint8 sListboxBorderStyle;
|
||||
static nsILookAndFeel::nsColorID sListboxBorderColorID;
|
||||
static PRBool sListboxBGTransparent;
|
||||
static nsILookAndFeel::nsColorID sListboxBGColorID;
|
||||
static nsILookAndFeel::nsColorID sListboxDisabledBGColorID;
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIAtom> mDefaultAtom;
|
||||
|
|
Загрузка…
Ссылка в новой задаче