зеркало из 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;
|
sTextfieldBorderSize.right = sTextfieldBorderSize.bottom = 2;
|
||||||
sTextfieldBGTransparent = PR_FALSE;
|
sTextfieldBGTransparent = PR_FALSE;
|
||||||
sListboxBGTransparent = PR_TRUE;
|
sListboxBGTransparent = PR_TRUE;
|
||||||
|
sTextfieldDisabledBGColorID = nsILookAndFeel::eColor__moz_field;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,10 +52,24 @@
|
||||||
|
|
||||||
nsMargin nsNativeTheme::sButtonBorderSize(2, 2, 2, 2);
|
nsMargin nsNativeTheme::sButtonBorderSize(2, 2, 2, 2);
|
||||||
nsMargin nsNativeTheme::sButtonDisabledBorderSize(1, 1, 1, 1);
|
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);
|
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;
|
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);
|
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;
|
PRBool nsNativeTheme::sListboxBGTransparent = PR_FALSE;
|
||||||
|
nsILookAndFeel::nsColorID nsNativeTheme::sListboxBGColorID = nsILookAndFeel::eColor__moz_field;
|
||||||
|
nsILookAndFeel::nsColorID nsNativeTheme::sListboxDisabledBGColorID = nsILookAndFeel::eColor_threedface;
|
||||||
|
|
||||||
nsNativeTheme::nsNativeTheme()
|
nsNativeTheme::nsNativeTheme()
|
||||||
{
|
{
|
||||||
|
@ -216,50 +230,53 @@ nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext, nsIFrame* aFrame,
|
||||||
case NS_THEME_BUTTON:
|
case NS_THEME_BUTTON:
|
||||||
if (IsDisabled(aFrame)) {
|
if (IsDisabled(aFrame)) {
|
||||||
ConvertMarginToTwips(sButtonDisabledBorderSize, defaultBorderSize, p2t);
|
ConvertMarginToTwips(sButtonDisabledBorderSize, defaultBorderSize, p2t);
|
||||||
defaultBorderStyle = NS_STYLE_BORDER_STYLE_OUTSET;
|
defaultBorderStyle = sButtonInactiveBorderStyle;
|
||||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_threedshadow,
|
lookAndFeel->GetColor(sButtonDisabledBorderColorID,
|
||||||
defaultBorderColor);
|
defaultBorderColor);
|
||||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_threedface,
|
lookAndFeel->GetColor(sButtonDisabledBGColorID,
|
||||||
defaultBGColor);
|
defaultBGColor);
|
||||||
} else {
|
} else {
|
||||||
PRInt32 contentState = GetContentState(aFrame, aWidgetType);
|
PRInt32 contentState = GetContentState(aFrame, aWidgetType);
|
||||||
ConvertMarginToTwips(sButtonBorderSize, defaultBorderSize, p2t);
|
ConvertMarginToTwips(sButtonBorderSize, defaultBorderSize, p2t);
|
||||||
if (contentState & NS_EVENT_STATE_HOVER &&
|
if (contentState & NS_EVENT_STATE_HOVER &&
|
||||||
contentState & NS_EVENT_STATE_ACTIVE)
|
contentState & NS_EVENT_STATE_ACTIVE)
|
||||||
defaultBorderStyle = NS_STYLE_BORDER_STYLE_INSET;
|
defaultBorderStyle = sButtonActiveBorderStyle;
|
||||||
else
|
else
|
||||||
defaultBorderStyle = NS_STYLE_BORDER_STYLE_OUTSET;
|
defaultBorderStyle = sButtonInactiveBorderStyle;
|
||||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_threedface,
|
lookAndFeel->GetColor(sButtonBorderColorID,
|
||||||
|
defaultBorderColor);
|
||||||
|
lookAndFeel->GetColor(sButtonBGColorID,
|
||||||
defaultBorderColor);
|
defaultBorderColor);
|
||||||
defaultBGColor = defaultBorderColor;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NS_THEME_TEXTFIELD:
|
case NS_THEME_TEXTFIELD:
|
||||||
defaultBorderStyle = NS_STYLE_BORDER_STYLE_INSET;
|
defaultBorderStyle = sTextfieldBorderStyle;
|
||||||
ConvertMarginToTwips(sTextfieldBorderSize, defaultBorderSize, p2t);
|
ConvertMarginToTwips(sTextfieldBorderSize, defaultBorderSize, p2t);
|
||||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_threedface,
|
lookAndFeel->GetColor(sTextfieldBorderColorID,
|
||||||
defaultBorderColor);
|
defaultBorderColor);
|
||||||
if (!(defaultBGTransparent = sTextfieldBGTransparent)) {
|
if (!(defaultBGTransparent = sTextfieldBGTransparent)) {
|
||||||
if (IsDisabled(aFrame))
|
if (IsDisabled(aFrame))
|
||||||
defaultBGColor = defaultBorderColor;
|
lookAndFeel->GetColor(sTextfieldDisabledBGColorID,
|
||||||
|
defaultBGColor);
|
||||||
else
|
else
|
||||||
lookAndFeel->GetColor(nsILookAndFeel::eColor__moz_field,
|
lookAndFeel->GetColor(sTextfieldBGColorID,
|
||||||
defaultBGColor);
|
defaultBGColor);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NS_THEME_LISTBOX:
|
case NS_THEME_LISTBOX:
|
||||||
case NS_THEME_DROPDOWN:
|
case NS_THEME_DROPDOWN:
|
||||||
defaultBorderStyle = NS_STYLE_BORDER_STYLE_INSET;
|
defaultBorderStyle = sListboxBorderStyle;
|
||||||
ConvertMarginToTwips(sListboxBorderSize, defaultBorderSize, p2t);
|
ConvertMarginToTwips(sListboxBorderSize, defaultBorderSize, p2t);
|
||||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_threedface,
|
lookAndFeel->GetColor(sListboxBorderColorID,
|
||||||
defaultBorderColor);
|
defaultBorderColor);
|
||||||
if (!(defaultBGTransparent = sListboxBGTransparent)) {
|
if (!(defaultBGTransparent = sListboxBGTransparent)) {
|
||||||
if (IsDisabled(aFrame))
|
if (IsDisabled(aFrame))
|
||||||
defaultBGColor = defaultBorderColor;
|
lookAndFeel->GetColor(sListboxDisabledBGColorID,
|
||||||
|
defaultBorderColor);
|
||||||
else
|
else
|
||||||
lookAndFeel->GetColor(nsILookAndFeel::eColor__moz_field,
|
lookAndFeel->GetColor(sListboxBGColorID,
|
||||||
defaultBGColor);
|
defaultBGColor);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsMargin.h"
|
#include "nsMargin.h"
|
||||||
|
#include "nsILookAndFeel.h"
|
||||||
|
|
||||||
class nsIFrame;
|
class nsIFrame;
|
||||||
class nsIPresShell;
|
class nsIPresShell;
|
||||||
|
@ -155,12 +156,26 @@ protected:
|
||||||
|
|
||||||
// these should be set to appropriate platform values by the subclass, to
|
// these should be set to appropriate platform values by the subclass, to
|
||||||
// match the values in platform-forms.css. These defaults match forms.css
|
// match the values in platform-forms.css. These defaults match forms.css
|
||||||
static nsMargin sButtonBorderSize;
|
static nsMargin sButtonBorderSize;
|
||||||
static nsMargin sButtonDisabledBorderSize;
|
static nsMargin sButtonDisabledBorderSize;
|
||||||
static nsMargin sTextfieldBorderSize;
|
static PRUint8 sButtonActiveBorderStyle;
|
||||||
static PRBool sTextfieldBGTransparent;
|
static PRUint8 sButtonInactiveBorderStyle;
|
||||||
static nsMargin sListboxBorderSize;
|
static nsILookAndFeel::nsColorID sButtonBorderColorID;
|
||||||
static PRBool sListboxBGTransparent;
|
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:
|
private:
|
||||||
nsCOMPtr<nsIAtom> mDefaultAtom;
|
nsCOMPtr<nsIAtom> mDefaultAtom;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче