Fix several problems with aqua form controls:
- don't disable -moz-appearance because the textfield has a transparent background - don't draw a focus border for buttons, because of an OS bug that causes ugly lines through them - make sure button text doesn't move when the button is pressed - make sure buttons don't get a dotted internal focus border - don't allow colors to be overridden on buttons for now Also fixes dependencies in gfx/src/mac/Makefile.in. Bug 197094, r=pinkerton, sr=bzbarsky. git-svn-id: svn://10.0.0.236/trunk@140729 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -73,17 +73,16 @@ CPPSRCS = \
|
||||
nsNativeThemeMac.cpp \
|
||||
$(NULL)
|
||||
|
||||
# $(DIST)/lib/libimg_s.a \
|
||||
SHARED_LIBRARY_LIBS = $(DIST)/lib/$(LIB_PREFIX)gfxshared_s.$(LIB_SUFFIX)
|
||||
EXTRA_DSO_LIBS = mozutil_s gkgfx
|
||||
EXTRA_DEPS = $(DIST)/lib/$(LIB_PREFIX)mozutil_s.$(LIB_SUFFIX)
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(MKSHLIB_FORCE_ALL) \
|
||||
$(DIST)/lib/libmozutil_s.a \
|
||||
-lgkgfx \
|
||||
-lgfxshared_s \
|
||||
$(MKSHLIB_UNFORCE_ALL) \
|
||||
$(TK_LIBS) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
$(LIBS_DIR) \
|
||||
$(EXTRA_DSO_LIBS) \
|
||||
$(TK_LIBS) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../shared \
|
||||
|
||||
@@ -97,7 +97,8 @@ nsNativeThemeMac::nsNativeThemeMac()
|
||||
if (!sInitializedBorders) {
|
||||
sInitializedBorders = PR_TRUE;
|
||||
sTextfieldBorderSize.left = sTextfieldBorderSize.top = 2;
|
||||
sTextfieldBorderSize.right = sTextfieldBorderSize.bottom = 1;
|
||||
sTextfieldBorderSize.right = sTextfieldBorderSize.bottom = 2;
|
||||
sTextfieldBGTransparent = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,8 +167,14 @@ nsNativeThemeMac::DrawButton ( ThemeButtonKind inKind, const Rect& inBoxRect, PR
|
||||
kThemeStatePressed : kThemeStateActive;
|
||||
info.value = inValue;
|
||||
info.adornment = inAdornment;
|
||||
if ( inState & NS_EVENT_STATE_FOCUS )
|
||||
info.adornment = kThemeAdornmentFocus;
|
||||
if ( inState & NS_EVENT_STATE_FOCUS ) {
|
||||
// There is a bug in OS 10.2 and higher where if we are in a CG context and
|
||||
// draw the focus ring with DrawThemeButton(), there are ugly lines all
|
||||
// through the button. This may get fixed in a dot-release, but until it
|
||||
// does, we can't draw the focus ring.
|
||||
if (inKind != kThemePushButton || !nsRenderingContextMac::OnJaguar())
|
||||
info.adornment = kThemeAdornmentFocus;
|
||||
}
|
||||
if ( inIsDefault )
|
||||
info.adornment |= kThemeAdornmentDefault;
|
||||
|
||||
@@ -507,7 +514,7 @@ nsNativeThemeMac::GetWidgetBorder(nsIDeviceContext* aContext,
|
||||
|
||||
case NS_THEME_TEXTFIELD:
|
||||
{
|
||||
aResult->SizeTo(2, 2, 1, 1);
|
||||
aResult->SizeTo(2, 2, 2, 2);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1535,3 +1535,17 @@ nsRenderingContextMac::OnMacOSX()
|
||||
}
|
||||
return gOnMacOSX;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsRenderingContextMac::OnJaguar()
|
||||
{
|
||||
static PRBool sInitVer = PR_FALSE;
|
||||
static PRBool sOnJaguar = PR_FALSE;
|
||||
if (!sInitVer) {
|
||||
long version;
|
||||
OSErr err = ::Gestalt(gestaltSystemVersion, &version);
|
||||
sOnJaguar = (err == noErr && version >= 0x00001020);
|
||||
sInitVer = PR_TRUE;
|
||||
}
|
||||
return sOnJaguar;
|
||||
}
|
||||
|
||||
@@ -185,6 +185,7 @@ public:
|
||||
|
||||
// useful for determining if we're running on MacOSX
|
||||
static PRBool OnMacOSX();
|
||||
static PRBool OnJaguar();
|
||||
|
||||
protected:
|
||||
enum GraphicStateChanges {
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
nsMargin nsNativeTheme::sButtonBorderSize(2, 2, 2, 2);
|
||||
nsMargin nsNativeTheme::sButtonDisabledBorderSize(1, 1, 1, 1);
|
||||
nsMargin nsNativeTheme::sTextfieldBorderSize(2, 2, 2, 2);
|
||||
PRBool nsNativeTheme::sTextfieldBGTransparent = PR_FALSE;
|
||||
|
||||
nsNativeTheme::nsNativeTheme()
|
||||
{
|
||||
@@ -217,7 +218,9 @@ nsNativeTheme::IsWidgetStyled(nsIPresContext* aPresContext, nsIFrame* aFrame,
|
||||
PRUint8 aWidgetType)
|
||||
{
|
||||
// Check for specific widgets to see if HTML has overridden the style.
|
||||
if (aFrame && (aWidgetType == NS_THEME_BUTTON || aWidgetType == NS_THEME_TEXTFIELD)) {
|
||||
if (aFrame && (aWidgetType == NS_THEME_BUTTON ||
|
||||
aWidgetType == NS_THEME_TEXTFIELD)) {
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
aFrame->GetContent(getter_AddRefs(content));
|
||||
if (content->IsContentOfType(nsIContent::eHTML)) {
|
||||
@@ -225,6 +228,7 @@ nsNativeTheme::IsWidgetStyled(nsIPresContext* aPresContext, nsIFrame* aFrame,
|
||||
nscolor defaultBGColor, defaultBorderColor;
|
||||
PRUint8 defaultBorderStyle;
|
||||
nsMargin defaultBorderSize;
|
||||
PRBool defaultBGTransparent = PR_FALSE;
|
||||
|
||||
float p2t;
|
||||
aPresContext->GetPixelsToTwips(&p2t);
|
||||
@@ -262,11 +266,13 @@ nsNativeTheme::IsWidgetStyled(nsIPresContext* aPresContext, nsIFrame* aFrame,
|
||||
ConvertMarginToTwips(sTextfieldBorderSize, defaultBorderSize, p2t);
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_threedface,
|
||||
defaultBorderColor);
|
||||
if (IsDisabled(aFrame))
|
||||
defaultBGColor = defaultBorderColor;
|
||||
else
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor__moz_field,
|
||||
defaultBGColor);
|
||||
if (!(defaultBGTransparent = sTextfieldBGTransparent)) {
|
||||
if (IsDisabled(aFrame))
|
||||
defaultBGColor = defaultBorderColor;
|
||||
else
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor__moz_field,
|
||||
defaultBGColor);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -278,9 +284,14 @@ nsNativeTheme::IsWidgetStyled(nsIPresContext* aPresContext, nsIFrame* aFrame,
|
||||
const nsStyleBackground* ourBG;
|
||||
::GetStyleData(aFrame, &ourBG);
|
||||
|
||||
if (ourBG->mBackgroundColor != defaultBGColor ||
|
||||
ourBG->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT ||
|
||||
!(ourBG->mBackgroundFlags & NS_STYLE_BG_IMAGE_NONE))
|
||||
if (defaultBGTransparent) {
|
||||
if (!(ourBG->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT))
|
||||
return PR_TRUE;
|
||||
} else if (ourBG->mBackgroundColor != defaultBGColor ||
|
||||
ourBG->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)
|
||||
return PR_TRUE;
|
||||
|
||||
if (!(ourBG->mBackgroundFlags & NS_STYLE_BG_IMAGE_NONE))
|
||||
return PR_TRUE;
|
||||
|
||||
// Check whether border style or color differs from default
|
||||
|
||||
@@ -153,6 +153,7 @@ protected:
|
||||
static nsMargin sButtonBorderSize;
|
||||
static nsMargin sButtonDisabledBorderSize;
|
||||
static nsMargin sTextfieldBorderSize;
|
||||
static PRBool sTextfieldBGTransparent;
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIAtom> mFocusedAtom;
|
||||
|
||||
@@ -37,10 +37,7 @@
|
||||
@import url("resource:/res/forms.css");
|
||||
|
||||
input {
|
||||
border-left-width: 2px;
|
||||
border-top-width: 2px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-width: 2px;
|
||||
padding: 0 2px 0 1px;
|
||||
font-size: 11px;
|
||||
background-color: transparent;
|
||||
@@ -55,7 +52,7 @@ select {
|
||||
}
|
||||
|
||||
select[size] {
|
||||
-moz-appearance: none;
|
||||
-moz-appearance: listbox;
|
||||
margin: 0px;
|
||||
background-color: -moz-Field !important;
|
||||
}
|
||||
@@ -102,4 +99,36 @@ input[type="button"],
|
||||
input[type="submit"] {
|
||||
-moz-appearance: button-small;
|
||||
font-size: 11px;
|
||||
margin: 0px 3px;
|
||||
padding: 0;
|
||||
border-width: 2px 8px 2px 8px;
|
||||
color: -moz-FieldText !important;
|
||||
}
|
||||
|
||||
button:active:hover,
|
||||
input[type="reset"]:active:hover,
|
||||
input[type="button"]:active:hover,
|
||||
input[type="submit"]:active:hover {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
button:-moz-focus-inner,
|
||||
input[type="reset"]:-moz-focus-inner,
|
||||
input[type="button"]:-moz-focus-inner,
|
||||
input[type="submit"]:-moz-focus-inner,
|
||||
input[type="file"] > input[type="button"]:focus:-moz-focus-inner {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
button[disabled]:active, button[disabled],
|
||||
input[type="reset"][disabled]:active,
|
||||
input[type="reset"][disabled],
|
||||
input[type="button"][disabled]:active,
|
||||
input[type="button"][disabled],
|
||||
input[type="submit"][disabled]:active,
|
||||
input[type="submit"][disabled] {
|
||||
padding: 0;
|
||||
border-width: 2px 8px 2px 8px;
|
||||
color: GrayText !important;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user