зеркало из https://github.com/mozilla/gecko-dev.git
Differentiate between single line and multiline text fields/areas so that we can render them differently. On Mac OS X render multiline text areas as Aqua text areas. b=377331 r=smorgan sr=roc
This commit is contained in:
Родитель
db775f99cc
Коммит
58a0e676e8
|
@ -156,6 +156,9 @@
|
|||
// The caret of a text area
|
||||
#define NS_THEME_TEXTFIELD_CARET 96
|
||||
|
||||
// A multiline text field
|
||||
#define NS_THEME_TEXTFIELD_MULTILINE 97
|
||||
|
||||
// A dropdown list.
|
||||
#define NS_THEME_DROPDOWN 101
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ textarea {
|
|||
vertical-align: text-bottom;
|
||||
cursor: text;
|
||||
-moz-binding: url("chrome://global/content/platformHTMLBindings.xml#textAreas");
|
||||
-moz-appearance: textfield;
|
||||
-moz-appearance: textfield-multiline;
|
||||
text-indent: 0;
|
||||
-moz-user-select: text;
|
||||
}
|
||||
|
|
|
@ -515,6 +515,7 @@ CSS_KEY(scrollbarthumb-vertical, scrollbarthumb_vertical)
|
|||
CSS_KEY(scrollbargripper-horizontal, scrollbargripper_horizontal)
|
||||
CSS_KEY(scrollbargripper-vertical, scrollbargripper_vertical)
|
||||
CSS_KEY(textfield, textfield)
|
||||
CSS_KEY(textfield-multiline, textfield_multiline)
|
||||
CSS_KEY(caret, caret)
|
||||
CSS_KEY(menubar, menubar)
|
||||
CSS_KEY(menupopup, menupopup)
|
||||
|
|
|
@ -231,6 +231,7 @@ const PRInt32 nsCSSProps::kAppearanceKTable[] = {
|
|||
eCSSKeyword_scrollbargripper_horizontal, NS_THEME_SCROLLBAR_GRIPPER_HORIZONTAL,
|
||||
eCSSKeyword_scrollbargripper_vertical, NS_THEME_SCROLLBAR_GRIPPER_VERTICAL,
|
||||
eCSSKeyword_textfield, NS_THEME_TEXTFIELD,
|
||||
eCSSKeyword_textfield_multiline, NS_THEME_TEXTFIELD_MULTILINE,
|
||||
eCSSKeyword_caret, NS_THEME_TEXTFIELD_CARET,
|
||||
eCSSKeyword_menulist, NS_THEME_DROPDOWN,
|
||||
eCSSKeyword_menulistbutton, NS_THEME_DROPDOWN_BUTTON,
|
||||
|
|
|
@ -810,7 +810,34 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
|
|||
case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
|
||||
// do nothing, drawn by scrollbar
|
||||
break;
|
||||
|
||||
|
||||
case NS_THEME_TEXTFIELD_MULTILINE: {
|
||||
// we have to draw this by hand because there is no HITheme value for it
|
||||
CGContextSetRGBFillColor(cgContext, 1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
CGContextFillRect(cgContext, macRect);
|
||||
|
||||
CGContextSetLineWidth(cgContext, 1.0);
|
||||
CGContextSetShouldAntialias(cgContext, false);
|
||||
|
||||
// stroke everything but the top line of the text area
|
||||
CGContextSetRGBStrokeColor(cgContext, 0.6, 0.6, 0.6, 1.0);
|
||||
CGContextBeginPath(cgContext);
|
||||
CGContextMoveToPoint(cgContext, macRect.origin.x, macRect.origin.y + 1);
|
||||
CGContextAddLineToPoint(cgContext, macRect.origin.x, macRect.origin.y + macRect.size.height);
|
||||
CGContextAddLineToPoint(cgContext, macRect.origin.x + macRect.size.width - 1, macRect.origin.y + macRect.size.height);
|
||||
CGContextAddLineToPoint(cgContext, macRect.origin.x + macRect.size.width - 1, macRect.origin.y + 1);
|
||||
CGContextStrokePath(cgContext);
|
||||
|
||||
// stroke the line across the top of the text area
|
||||
CGContextSetRGBStrokeColor(cgContext, 0.4510, 0.4510, 0.4510, 1.0);
|
||||
CGContextBeginPath(cgContext);
|
||||
CGContextMoveToPoint(cgContext, macRect.origin.x, macRect.origin.y + 1);
|
||||
CGContextAddLineToPoint(cgContext, macRect.origin.x + macRect.size.width - 1, macRect.origin.y + 1);
|
||||
CGContextStrokePath(cgContext);
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_THEME_LISTBOX:
|
||||
// HIThemeSetFill is not available on 10.3
|
||||
CGContextSetRGBFillColor(cgContext, 1.0, 1.0, 1.0, 1.0);
|
||||
|
@ -870,12 +897,17 @@ nsNativeThemeCocoa::GetWidgetBorder(nsIDeviceContext* aContext,
|
|||
}
|
||||
break;
|
||||
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
aResult->SizeTo(1, 1, 1, 1);
|
||||
break;
|
||||
|
||||
case NS_THEME_LISTBOX: {
|
||||
SInt32 frameOutset = 0;
|
||||
::GetThemeMetric(kThemeMetricListBoxFrameOutset, &frameOutset);
|
||||
aResult->SizeTo(frameOutset, frameOutset, frameOutset, frameOutset);
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
|
||||
case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
|
||||
{
|
||||
|
@ -916,6 +948,7 @@ nsNativeThemeCocoa::GetWidgetPadding(nsIDeviceContext* aContext,
|
|||
switch (aWidgetType)
|
||||
{
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
{
|
||||
SInt32 nativePadding = 0;
|
||||
::GetThemeMetric(kThemeMetricEditTextWhitespace, &nativePadding);
|
||||
|
@ -936,6 +969,7 @@ nsNativeThemeCocoa::GetWidgetOverflow(nsIDeviceContext* aContext, nsIFrame* aFra
|
|||
case NS_THEME_BUTTON:
|
||||
case NS_THEME_BUTTON_SMALL:
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
case NS_THEME_LISTBOX:
|
||||
case NS_THEME_DROPDOWN:
|
||||
case NS_THEME_DROPDOWN_BUTTON:
|
||||
|
@ -1044,6 +1078,7 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsIRenderingContext* aContext,
|
|||
}
|
||||
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
{
|
||||
// at minimum, we should be tall enough for 9pt text.
|
||||
// I'm using hardcoded values here because the appearance manager
|
||||
|
@ -1219,6 +1254,7 @@ nsNativeThemeCocoa::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
case NS_THEME_TAB_PANELS:
|
||||
case NS_THEME_TAB_PANEL:
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
case NS_THEME_DIALOG:
|
||||
case NS_THEME_MENUPOPUP:
|
||||
*aShouldRepaint = PR_FALSE;
|
||||
|
@ -1291,6 +1327,7 @@ nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* a
|
|||
case NS_THEME_TOOLBAR:
|
||||
case NS_THEME_STATUSBAR:
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
//case NS_THEME_TOOLBOX:
|
||||
//case NS_THEME_TOOLBAR_BUTTON:
|
||||
case NS_THEME_PROGRESSBAR:
|
||||
|
|
|
@ -223,6 +223,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
|
|||
// actually has element focus, so we check the focused attribute
|
||||
// to see whether to draw in the focused state.
|
||||
if (aWidgetType == NS_THEME_TEXTFIELD ||
|
||||
aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
|
||||
aWidgetType == NS_THEME_DROPDOWN_TEXTFIELD ||
|
||||
aWidgetType == NS_THEME_RADIO_CONTAINER ||
|
||||
aWidgetType == NS_THEME_RADIO_LABEL ||
|
||||
|
@ -351,6 +352,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
|
|||
aGtkWidgetType = MOZ_GTK_GRIPPER;
|
||||
break;
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
case NS_THEME_DROPDOWN_TEXTFIELD:
|
||||
aGtkWidgetType = MOZ_GTK_ENTRY;
|
||||
break;
|
||||
|
@ -1008,6 +1010,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
|
|||
// case NS_THEME_SCROLLBAR_GRIPPER_HORIZONTAL: (n/a for gtk)
|
||||
// case NS_THEME_SCROLLBAR_GRIPPER_VERTICAL: (n/a for gtk)
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
// case NS_THEME_TEXTFIELD_CARET:
|
||||
case NS_THEME_DROPDOWN_BUTTON:
|
||||
case NS_THEME_DROPDOWN_TEXTFIELD:
|
||||
|
|
|
@ -269,6 +269,7 @@ nsNativeThemeWin::GetTheme(PRUint8 aWidgetType)
|
|||
return mButtonTheme;
|
||||
}
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
case NS_THEME_DROPDOWN: {
|
||||
if (!mTextFieldTheme)
|
||||
mTextFieldTheme = openTheme(NULL, L"Edit");
|
||||
|
@ -457,6 +458,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
return NS_OK;
|
||||
}
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
case NS_THEME_DROPDOWN: {
|
||||
aPart = TFP_TEXTFIELD;
|
||||
if (!aFrame) {
|
||||
|
@ -1020,7 +1022,7 @@ nsNativeThemeWin::GetWidgetBorder(nsIDeviceContext* aContext,
|
|||
// Remove the left edge, since we won't be drawing it.
|
||||
aResult->left = 0;
|
||||
|
||||
if (aFrame && aWidgetType == NS_THEME_TEXTFIELD) {
|
||||
if (aFrame && (aWidgetType == NS_THEME_TEXTFIELD || aWidgetType == NS_THEME_TEXTFIELD_MULTILINE)) {
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
if (content && content->IsNodeOfType(nsINode::eHTML)) {
|
||||
// We need to pad textfields by 1 pixel, since the caret will draw
|
||||
|
@ -1283,6 +1285,7 @@ nsNativeThemeWin::ClassicThemeSupportsWidget(nsPresContext* aPresContext,
|
|||
switch (aWidgetType) {
|
||||
case NS_THEME_BUTTON:
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
case NS_THEME_CHECKBOX:
|
||||
case NS_THEME_RADIO:
|
||||
case NS_THEME_SCROLLBAR_BUTTON_UP:
|
||||
|
@ -1358,6 +1361,7 @@ nsNativeThemeWin::ClassicGetWidgetBorder(nsIDeviceContext* aContext,
|
|||
case NS_THEME_TAB_LEFT_EDGE:
|
||||
case NS_THEME_TAB_RIGHT_EDGE:
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
(*aResult).top = (*aResult).left = (*aResult).bottom = (*aResult).right = 2;
|
||||
break;
|
||||
case NS_THEME_STATUSBAR_PANEL:
|
||||
|
@ -1463,7 +1467,8 @@ nsNativeThemeWin::ClassicGetMinimumWidgetSize(nsIRenderingContext* aContext, nsI
|
|||
case NS_THEME_BUTTON:
|
||||
case NS_THEME_LISTBOX:
|
||||
case NS_THEME_TREEVIEW:
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
case NS_THEME_DROPDOWN_TEXTFIELD:
|
||||
case NS_THEME_STATUSBAR:
|
||||
case NS_THEME_STATUSBAR_PANEL:
|
||||
|
@ -1644,6 +1649,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
|||
case NS_THEME_LISTBOX:
|
||||
case NS_THEME_TREEVIEW:
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
case NS_THEME_DROPDOWN:
|
||||
case NS_THEME_DROPDOWN_TEXTFIELD:
|
||||
case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
|
||||
|
@ -2019,6 +2025,7 @@ RENDER_AGAIN:
|
|||
}
|
||||
// Draw controls with 2px 3D inset border
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
case NS_THEME_LISTBOX:
|
||||
case NS_THEME_DROPDOWN:
|
||||
case NS_THEME_DROPDOWN_TEXTFIELD: {
|
||||
|
@ -2258,6 +2265,7 @@ nsNativeThemeWin::GetWidgetNativeDrawingFlags(PRUint8 aWidgetType)
|
|||
switch (aWidgetType) {
|
||||
case NS_THEME_BUTTON:
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
|
||||
case NS_THEME_DROPDOWN:
|
||||
case NS_THEME_DROPDOWN_TEXTFIELD:
|
||||
|
|
|
@ -189,6 +189,7 @@ nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext, nsIFrame* aFrame,
|
|||
// Check for specific widgets to see if HTML has overridden the style.
|
||||
if (aFrame && (aWidgetType == NS_THEME_BUTTON ||
|
||||
aWidgetType == NS_THEME_TEXTFIELD ||
|
||||
aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
|
||||
aWidgetType == NS_THEME_LISTBOX ||
|
||||
aWidgetType == NS_THEME_DROPDOWN)) {
|
||||
|
||||
|
@ -225,6 +226,7 @@ nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext, nsIFrame* aFrame,
|
|||
break;
|
||||
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
defaultBorderStyle = sTextfieldBorderStyle;
|
||||
ConvertMarginToAppUnits(sTextfieldBorderSize, defaultBorderSize);
|
||||
lookAndFeel->GetColor(sTextfieldBorderColorID,
|
||||
|
|
Загрузка…
Ссылка в новой задаче