cocoa native text fields draw outside bounds, have incorrect border/padding setup. b=370593 r=smorgan sr=dbaron

This commit is contained in:
joshmoz%gmail.com 2007-02-16 18:18:48 +00:00
Родитель 7b84970202
Коммит da0f6afca1
2 изменённых файлов: 30 добавлений и 17 удалений

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

@ -597,12 +597,7 @@ input[disabled] {
textarea,
textarea[disabled] {
-moz-appearance: none; /* we'll draw by hand, thanks */
border-style: solid;
border-color: #737373 #999999 #999999 #999999;
border-width: 1px;
padding: 0px 0px 0px 0px;
font-size: 11px;
margin: 1px 1px 1px 0px;
background-color: -moz-field;
}
@ -710,14 +705,6 @@ button[disabled]:active {
-moz-appearance: none;
}
/* this turns off the mozilla focus ring shown inside clicked or selected buttons */
input[type="reset"]::-moz-focus-inner,
input[type="button"]::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner,
input[type="file"] > input[type="button"]::-moz-focus-inner {
border: 0;
}
/* tweak position of button part of file selector */
input[type="file"] > input[type="button"] {
margin: 0px 0px 2px 5px !important;

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

@ -175,14 +175,30 @@ nsNativeThemeCocoa::DrawFrame(CGContextRef cgContext, HIThemeFrameKind inKind,
fdi.version = 0;
fdi.kind = inKind;
fdi.state = inIsDisabled ? (ThemeDrawState) kThemeStateDisabled : (ThemeDrawState) kThemeStateActive;
fdi.isFocused = (inState & NS_EVENT_STATE_FOCUS) != 0;
// We do not draw focus rings for frame widgets because their complex layout has nasty
// drawing bugs and it looks terrible.
// fdi.isFocused = (inState & NS_EVENT_STATE_FOCUS) != 0;
fdi.isFocused = 0;
// HIThemeDrawFrame takes the rect for the content area of the frame, not
// the bounding rect for the frame. Here we reduce the size of the rect we
// will pass to make it the size of the content.
HIRect drawRect = inBoxRect;
if (inKind == kHIThemeFrameTextFieldSquare) {
SInt32 frameOutset = 0;
::GetThemeMetric(kThemeMetricEditTextFrameOutset, &frameOutset);
drawRect.origin.x += frameOutset;
drawRect.origin.y += frameOutset;
drawRect.size.width -= frameOutset * 2;
drawRect.size.height -= frameOutset * 2;
}
#if DRAW_IN_FRAME_DEBUG
CGContextSetRGBFillColor(cgContext, 0.0, 0.0, 0.5, 0.8);
CGContextFillRect(cgContext, inBoxRect);
#endif
HIThemeDrawFrame(&inBoxRect, &fdi, cgContext, HITHEME_ORIENTATION);
HIThemeDrawFrame(&drawRect, &fdi, cgContext, HITHEME_ORIENTATION);
}
void
@ -657,8 +673,11 @@ nsNativeThemeCocoa::GetWidgetBorder(nsIDeviceContext* aContext,
kAquaDropwdonRightEndcap, kAquaPushButtonTopBottom);
break;
case NS_THEME_TEXTFIELD:
aResult->SizeTo(2, 2, 2, 2);
case NS_THEME_TEXTFIELD: {
SInt32 frameOutset = 0;
::GetThemeMetric(kThemeMetricEditTextFrameOutset, &frameOutset);
aResult->SizeTo(frameOutset, frameOutset, frameOutset, frameOutset);
}
break;
case NS_THEME_LISTBOX: {
@ -679,6 +698,13 @@ nsNativeThemeCocoa::GetWidgetPadding(nsIDeviceContext* aContext,
PRUint8 aWidgetType,
nsMargin* aResult)
{
if (aWidgetType == NS_THEME_TEXTFIELD) {
SInt32 nativePadding = 0;
::GetThemeMetric(kThemeMetricEditTextWhitespace, &nativePadding);
aResult->SizeTo(nativePadding, nativePadding, nativePadding, nativePadding);
return PR_TRUE;
}
return PR_FALSE;
}