Remove "layout.forms.use_standard_or_quirks" pref and the old quirks-mode form control code that it enabled. (See bug 91602.) b=131452 r=rods sr=attinasi a=asa

This commit is contained in:
dbaron%fas.harvard.edu 2002-03-27 06:13:32 +00:00
Родитель f940144626
Коммит 3e64376a4b
12 изменённых файлов: 133 добавлений и 844 удалений

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

@ -40,6 +40,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nscore.h"
#include "nsIServiceManager.h"
#include "nsRuleNode.h"
#include "nsIDeviceContext.h"
#include "nsILookAndFeel.h"
@ -52,10 +53,6 @@
#include "nsITheme.h"
#include "pldhash.h"
// Temporary - Test of full time Standard mode for forms
#include "nsIPref.h"
#include "nsIServiceManager.h"
/*
* For storage of an |nsRuleNode|'s children in a linked list.
*/
@ -1864,22 +1861,6 @@ SetFont(nsIPresContext* aPresContext, nsIStyleContext* aContext,
case NS_STYLE_FONT_THEME: sysID = eSystemFont_Theme; break;
}
nsCompatibility mode = eCompatibility_Standard;
if (sysID == eSystemFont_Field ||
sysID == eSystemFont_List ||
sysID == eSystemFont_Button) {
nsCOMPtr<nsIPref> prefService(do_GetService(NS_PREF_CONTRACTID));
if (prefService) {
PRBool useEitherMode;
if (NS_SUCCEEDED(prefService->GetBoolPref("layout.forms.use_standard_or_quirks", &useEitherMode))) {
if (useEitherMode) {
aPresContext->GetCompatibilityMode(&mode);
}
}
}
}
nsCOMPtr<nsIDeviceContext> dc;
aPresContext->GetDeviceContext(getter_AddRefs(dc));
if (dc) {
@ -1891,35 +1872,15 @@ SetFont(nsIPresContext* aPresContext, nsIStyleContext* aContext,
aFont->mSize = aFont->mFont.size; // this becomes our cascading size
}
// NavQuirks uses sans-serif instead of whatever the native font is
#if defined(XP_MAC) || defined(XP_MACOSX)
if (eCompatibility_NavQuirks == mode) {
switch (sysID) {
case eSystemFont_Field:
case eSystemFont_List:
aFont->mFont.name.Assign(NS_LITERAL_STRING("monospace"));
aFont->mSize = defaultFixedFont->size;
break;
case eSystemFont_Button:
aFont->mFont.name.Assign(NS_LITERAL_STRING("serif"));
aFont->mSize = defaultVariableFont->size;
break;
}
}
#endif
// XXXldb All of this platform-specific stuff should be in the
// nsIDeviceContext implementations, not here.
#if defined(XP_OS2)
switch (sysID) {
case eSystemFont_List:
case eSystemFont_Button:
aFont->mFont.name = defaultVariableFont->name;
break;
case eSystemFont_Field:
if (eCompatibility_NavQuirks == mode)
aFont->mFont.name.Assign(NS_LITERAL_STRING("monospace"));
else
aFont->mFont.name = defaultVariableFont->name;
break;
switch (sysID) {
case eSystemFont_List:
case eSystemFont_Button:
case eSystemFont_Field:
aFont->mFont.name = defaultVariableFont->name;
break;
}
#endif
@ -1932,65 +1893,19 @@ SetFont(nsIPresContext* aPresContext, nsIStyleContext* aContext,
//
switch (sysID) {
// Fields (text fields)
//
// For NavQuirks:
// We always use the monospace font and whatever
// the "fixed" font size this that is set by the browser
//
// For Standard/Strict Mode:
// Button and Selects (listboxes/comboboxes)
// We use whatever font is defined by the system. Which it appears
// (and the assumption is) it is always a proportional font. Then we
// always use 2 points smaller than what the browser has defined as
// the default proportional font.
case eSystemFont_Field:
if (eCompatibility_NavQuirks == mode) {
aFont->mFont.name.Assign(NS_LITERAL_STRING("monospace"));
aFont->mSize = defaultFixedFont->size;
} else {
// Assumption: system defined font is proportional
aFont->mSize = PR_MAX(defaultVariableFont->size - NSIntPointsToTwips(2), 0);
}
break;
//
// Button and Selects (listboxes/comboboxes)
//
// For NavQuirks:
// We always use the sans-serif font and 2 point point sizes smaller
// that whatever the "proportional" font size this that is set by the browser
//
// For Standard/Strict Mode:
// We use whatever font is defined by the system. Which it appears
// (and the assumption is) it is always a proportional font. Then we
// always use 2 points smaller than what the browser has defined as
// the default proportional font.
case eSystemFont_Button:
case eSystemFont_List:
if (eCompatibility_NavQuirks == mode) {
aFont->mFont.name.Assign(NS_LITERAL_STRING("sans-serif"));
}
// Assumption: system defined font is proportional
aFont->mSize = PR_MAX(defaultVariableFont->size - NSIntPointsToTwips(2), 0);
break;
}
#endif
#if defined(XP_UNIX) && !defined(XP_MACOSX)
if (eCompatibility_NavQuirks == mode) {
switch (sysID) {
case eSystemFont_Field:
aFont->mFont.name.Assign(NS_LITERAL_STRING("monospace"));
aFont->mSize = defaultFixedFont->size;
break;
case eSystemFont_Button:
case eSystemFont_List:
aFont->mFont.name.Assign(NS_LITERAL_STRING("serif"));
aFont->mSize = defaultVariableFont->size;
break;
default:
NS_ERROR("unexpected SID");
}
}
#endif
}
else if (eCSSUnit_Inherit == aFontData.mFamily.GetUnit()) {
aInherited = PR_TRUE;

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

@ -90,11 +90,6 @@ static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
// it a synonym for "soft"
#define kTextControl_Wrap_Off "OFF"
// Temporary - Test of full time Standard mode for forms (Bug 91602)
#include "nsIPref.h"
PRPackedBool nsFormControlHelper::mCompatFirstTime = PR_TRUE;
PRPackedBool nsFormControlHelper::mUseEitherMode = PR_FALSE;
MOZ_DECL_CTOR_COUNTER(nsFormControlHelper)
@ -156,22 +151,6 @@ void nsFormControlHelper::GetBoolString(const PRBool aValue,
}
nsCompatibility
nsFormControlHelper::GetRepChars(nsIPresContext* aPresContext, char& char1, char& char2)
{
nsCompatibility mode;
nsFormControlHelper::GetFormCompatibilityMode(aPresContext, mode);
if (eCompatibility_Standard == mode) {
char1 = 'W';
char2 = 'w';
return eCompatibility_Standard;
} else {
char1 = 'W';
char2 = 'w';
return eCompatibility_NavQuirks;
}
}
nsresult nsFormControlHelper::GetFrameFontFM(nsIPresContext* aPresContext,
nsIFormControlFrame * aFrame,
nsIFontMetrics** aFontMet)
@ -259,7 +238,7 @@ nsFormControlHelper::CalcNavQuirkSizing(nsIPresContext* aPresContext,
maxCharWidth = NSToCoordRound(maxCharWidth * t2p);
char char1, char2;
GetRepChars(aPresContext, char1, char2);
GetRepChars(char1, char2);
nscoord char1Width, char2Width;
aRendContext->GetWidth(char1, char1Width);
@ -379,16 +358,12 @@ nsFormControlHelper::GetTextSize(nsIPresContext* aPresContext, nsIFormControlFra
}
char char1, char2;
nsCompatibility mode = GetRepChars(aPresContext, char1, char2);
GetRepChars(char1, char2);
nscoord char1Width, char2Width;
aRendContext->GetWidth(char1, char1Width);
aRendContext->GetWidth(char2, char2Width);
if (eCompatibility_Standard == mode) {
return ((char1Width + char2Width) / 2) + 1;
} else {
return (char1Width + char2Width) / 2;
}
return ((char1Width + char2Width) / 2) + 1;
}
nscoord
@ -398,7 +373,7 @@ nsFormControlHelper::GetTextSize(nsIPresContext* aPresContext, nsIFormControlFra
{
nsAutoString val;
char char1, char2;
GetRepChars(aPresContext, char1, char2);
GetRepChars(char1, char2);
int i;
for (i = 0; i < aNumChars; i+=2) {
val.Append(PRUnichar(char1));
@ -472,9 +447,6 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
}
#endif
nsCompatibility qMode;
nsFormControlHelper::GetFormCompatibilityMode(aPresContext, qMode);
// determine the width, char height, row height
if (NS_CONTENT_ATTR_HAS_VALUE == colStatus) { // col attr will provide width
PRInt32 col = ((colAttr.GetUnit() == eHTMLUnit_Pixel) ? colAttr.GetPixelValue() : colAttr.GetIntValue());
@ -486,23 +458,9 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
aDesiredSize.width = NSIntPixelsToTwips(col, p2t);
} else {
col = (col <= 0) ? 1 : col; // XXX why a default of 1 char, why hide it
if (eCompatibility_NavQuirks == qMode) {
nsCOMPtr<nsIFontMetrics> fontMet;
nsresult res = GetFrameFontFM(aPresContext, aFrame, getter_AddRefs(fontMet));
if (NS_SUCCEEDED(res) && fontMet) {
aRendContext->SetFont(fontMet);
aSpec.mColDefaultSize = col;
charWidth = CalcNavQuirkSizing(aPresContext, aRendContext, fontMet,
aFrame, aSpec, aDesiredSize);
} else {
charWidth = GetTextSize(aPresContext, aFrame, col, aDesiredSize, aRendContext);
}
}
}
if (eCompatibility_Standard == qMode) {
if (aSpec.mColSizeAttrInPixels) {
aWidthExplicit = PR_TRUE;
}
if (aSpec.mColSizeAttrInPixels) {
aWidthExplicit = PR_TRUE;
}
aMinSize.width = aDesiredSize.width;
} else {
@ -515,22 +473,7 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
charWidth = GetTextSize(aPresContext, aFrame, 1, aDesiredSize, aRendContext);
aDesiredSize.width = aSpec.mColDefaultSize;
} else { // use default width in num characters
if (eCompatibility_NavQuirks == qMode) {
nsCOMPtr<nsIFontMetrics> fontMet;
nsresult res = GetFrameFontFM(aPresContext, aFrame, getter_AddRefs(fontMet));
if (NS_SUCCEEDED(res) && fontMet) {
aRendContext->SetFont(fontMet);
// this passes in a
charWidth = CalcNavQuirkSizing(aPresContext, aRendContext, fontMet,
aFrame, aSpec, aDesiredSize);
} else {
NS_ASSERTION(fontMet, "Couldn't get Font Metrics");
aDesiredSize.width = 300; // arbitrary values
aDesiredSize.width = 1500;
}
} else {
charWidth = GetTextSize(aPresContext, aFrame, aSpec.mColDefaultSize, aDesiredSize, aRendContext);
}
charWidth = GetTextSize(aPresContext, aFrame, aSpec.mColDefaultSize, aDesiredSize, aRendContext);
}
aMinSize.width = aDesiredSize.width;
if (CSS_NOTSET != aCSSSize.width) { // css provides width
@ -545,25 +488,23 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
aMinSize.height = aDesiredSize.height;
// determine the height
if (eCompatibility_Standard == qMode) {
nsHTMLValue rowAttr;
nsresult rowStatus = NS_CONTENT_ATTR_NOT_THERE;
if (nsnull != aSpec.mRowSizeAttr) {
rowStatus = hContent->GetHTMLAttribute(aSpec.mRowSizeAttr, rowAttr);
}
if (NS_CONTENT_ATTR_HAS_VALUE == rowStatus) { // row attr will provide height
PRInt32 rowAttrInt = ((rowAttr.GetUnit() == eHTMLUnit_Pixel)
? rowAttr.GetPixelValue() : rowAttr.GetIntValue());
numRows = (rowAttrInt > 0) ? rowAttrInt : 1;
aDesiredSize.height = aDesiredSize.height * numRows;
} else {
aDesiredSize.height = aDesiredSize.height * aSpec.mRowDefaultSize;
if (CSS_NOTSET != aCSSSize.height) { // css provides height
NS_ASSERTION(aCSSSize.height > 0, "form control's computed height is <= 0");
if (NS_INTRINSICSIZE != aCSSSize.height) {
aDesiredSize.height = PR_MAX(aDesiredSize.height,aCSSSize.height);
aHeightExplicit = PR_TRUE;
}
nsHTMLValue rowAttr;
nsresult rowStatus = NS_CONTENT_ATTR_NOT_THERE;
if (nsnull != aSpec.mRowSizeAttr) {
rowStatus = hContent->GetHTMLAttribute(aSpec.mRowSizeAttr, rowAttr);
}
if (NS_CONTENT_ATTR_HAS_VALUE == rowStatus) { // row attr will provide height
PRInt32 rowAttrInt = ((rowAttr.GetUnit() == eHTMLUnit_Pixel)
? rowAttr.GetPixelValue() : rowAttr.GetIntValue());
numRows = (rowAttrInt > 0) ? rowAttrInt : 1;
aDesiredSize.height = aDesiredSize.height * numRows;
} else {
aDesiredSize.height = aDesiredSize.height * aSpec.mRowDefaultSize;
if (CSS_NOTSET != aCSSSize.height) { // css provides height
NS_ASSERTION(aCSSSize.height > 0, "form control's computed height is <= 0");
if (NS_INTRINSICSIZE != aCSSSize.height) {
aDesiredSize.height = PR_MAX(aDesiredSize.height,aCSSSize.height);
aHeightExplicit = PR_TRUE;
}
}
}
@ -579,7 +520,6 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
}
// this handles all of the input types rather than having them do it.
nsresult
nsFormControlHelper::GetFont(nsIFormControlFrame * aFormFrame,
nsIPresContext* aPresContext,
@ -588,69 +528,7 @@ nsFormControlHelper::GetFont(nsIFormControlFrame * aFormFrame,
{
const nsStyleFont* styleFont = (const nsStyleFont*)aStyleContext->GetStyleData(eStyleStruct_Font);
nsWidgetRendering m;
aPresContext->GetWidgetRenderingMode(&m);
// only add in padding if we are not Gfx, excluding the text widgets
PRBool requiresWidget = PR_FALSE;
aFormFrame->RequiresWidget(requiresWidget);
PRInt32 type;
aFormFrame->GetType(&type);
if (type!=NS_FORM_INPUT_TEXT &&
type!=NS_FORM_TEXTAREA &&
type!=NS_FORM_INPUT_PASSWORD) {
if (PR_TRUE != requiresWidget && eWidgetRendering_Gfx == m) {
aFont = &styleFont->mFont;
return NS_OK;
}
}
nsCompatibility mode;
nsFormControlHelper::GetFormCompatibilityMode(aPresContext, mode);
if (eCompatibility_Standard == mode) {
aFont = &styleFont->mFont;
return NS_OK;
}
switch (type) {
case NS_FORM_INPUT_TEXT:
case NS_FORM_TEXTAREA:
case NS_FORM_INPUT_PASSWORD:
aFont = &styleFont->mFont;
break;
case NS_FORM_INPUT_BUTTON:
case NS_FORM_INPUT_SUBMIT:
case NS_FORM_INPUT_RESET:
case NS_FORM_SELECT:
NS_ASSERTION(0, "getting the font here has been predicated");
#if 0
if ((styleFont->mFlags & NS_STYLE_FONT_FACE_EXPLICIT) ||
(styleFont->mFlags & NS_STYLE_FONT_SIZE_EXPLICIT)) {
aFont = styleFont->mFixedFont;
aFont.weight = NS_FONT_WEIGHT_NORMAL; // always normal weight
aFont.size = styleFont->mFont.size; // normal font size
if (0 == (styleFont->mFlags & NS_STYLE_FONT_FACE_EXPLICIT)) {
aFont.name = "Arial"; // XXX windows specific font
}
} else {
// use arial, scaled down one HTML size
// italics, decoration & variant(?) get used
aFont = styleFont->mFont;
aFont.name = "Arial"; // XXX windows specific font
aFont.weight = NS_FONT_WEIGHT_NORMAL;
const nsFont& normal = aPresContext->GetDefaultFontDeprecated();
PRInt32 scaler;
aPresContext->GetFontScaler(&scaler);
float scaleFactor = nsStyleUtil::GetScalingFactor(scaler);
PRInt32 fontIndex = nsStyleUtil::FindNextSmallerFontSize(aFont.size, (PRInt32)normal.size, scaleFactor, aPresContext);
aFont.size = nsStyleUtil::CalcFontPointSize(fontIndex, (PRInt32)normal.size, scaleFactor, aPresContext);
}
#endif
break;
}
aFont = &styleFont->mFont;
return NS_OK;
}
@ -999,31 +877,6 @@ nsFormControlHelper::DoManualSubmitOrReset(nsIPresContext* aPresContext,
return result;
}
// Temporary - Test of full time Standard mode for forms (Bug 91602)
//
void nsFormControlHelper::GetFormCompatibilityMode(nsIPresContext* aPresContext,
nsCompatibility& aCompatMode)
{
if (mCompatFirstTime) {
nsCOMPtr<nsIPref> prefService(do_GetService(NS_PREF_CONTRACTID));
if (prefService) {
PRBool useEitherMode;
if (NS_SUCCEEDED(prefService->GetBoolPref("layout.forms.use_standard_or_quirks", &useEitherMode))) {
if (useEitherMode) {
mUseEitherMode = PR_TRUE;
}
}
}
mCompatFirstTime = PR_FALSE;
}
if (mUseEitherMode) {
aPresContext->GetCompatibilityMode(&aCompatMode);
} else {
aCompatMode = eCompatibility_Standard;
}
}
nsresult
nsFormControlHelper::Reset(nsIFrame* aFrame, nsIPresContext* aPresContext)
{

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

@ -133,6 +133,7 @@ public:
PRInt32 aNumChars, nsSize& aSize,
nsIRenderingContext *aRendContext);
// XXX This could be removed now that we no longer have form quirks.
static nsresult GetFont(nsIFormControlFrame * aFormFrame,
nsIPresContext* aPresContext,
nsIStyleContext * aStyleContext,
@ -184,7 +185,10 @@ public:
static void GetBoolString(const PRBool aValue, nsAString& aResult);
static nsCompatibility GetRepChars(nsIPresContext* aPresContext, char& char1, char& char2);
static void GetRepChars(char& char1, char& char2) {
char1 = 'W';
char2 = 'w';
}
// wrap can be one of these three values.
typedef enum {
@ -357,15 +361,10 @@ public:
nsIStyleContext* aStyleContext, nsString& aLabel,
nsIFrame* aForFrame);
static void GetFormCompatibilityMode(nsIPresContext* aPresContext, nsCompatibility& mCompatMode);
protected:
nsFormControlHelper();
virtual ~nsFormControlHelper();
// Temporary - Test of full time Standard mode for forms (Bug 91602)
static PRPackedBool mCompatFirstTime;
static PRPackedBool mUseEitherMode;
};
#endif

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

@ -578,37 +578,33 @@ nsGfxButtonControlFrame::Reflow(nsIPresContext* aPresContext,
} else { // Normal reflow.
nsCompatibility mode = eCompatibility_NavQuirks;
//nsFormControlHelper::GetFormCompatibilityMode(aPresContext, mode);
if (mode == eCompatibility_NavQuirks) {
// nsHTMLButtonControlFrame::Reflow registers it for Standard Mode
// and sets up mPresContext
if (eReflowReason_Initial == aReflowState.reason) {
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
}
// Do NavQuirks Sizing and layout
rv = DoNavQuirksReflow(aPresContext, aDesiredSize, aReflowState, aStatus);
// Make sure we obey min/max-width and min/max-height
if (aDesiredSize.width > aReflowState.mComputedMaxWidth) {
aDesiredSize.width = aReflowState.mComputedMaxWidth;
}
if (aDesiredSize.width < aReflowState.mComputedMinWidth) {
aDesiredSize.width = aReflowState.mComputedMinWidth;
}
if (aDesiredSize.height > aReflowState.mComputedMaxHeight) {
aDesiredSize.height = aReflowState.mComputedMaxHeight;
}
if (aDesiredSize.height < aReflowState.mComputedMinHeight) {
aDesiredSize.height = aReflowState.mComputedMinHeight;
}
} else {
// Do Standard mode sizing and layout
rv = nsHTMLButtonControlFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
#if 1
// nsHTMLButtonControlFrame::Reflow registers it for Standard Mode
// and sets up mPresContext
if (eReflowReason_Initial == aReflowState.reason) {
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
}
// Do NavQuirks Sizing and layout
rv = DoNavQuirksReflow(aPresContext, aDesiredSize, aReflowState, aStatus);
// Make sure we obey min/max-width and min/max-height
if (aDesiredSize.width > aReflowState.mComputedMaxWidth) {
aDesiredSize.width = aReflowState.mComputedMaxWidth;
}
if (aDesiredSize.width < aReflowState.mComputedMinWidth) {
aDesiredSize.width = aReflowState.mComputedMinWidth;
}
if (aDesiredSize.height > aReflowState.mComputedMaxHeight) {
aDesiredSize.height = aReflowState.mComputedMaxHeight;
}
if (aDesiredSize.height < aReflowState.mComputedMinHeight) {
aDesiredSize.height = aReflowState.mComputedMinHeight;
}
#else
// Do Standard mode sizing and layout
rv = nsHTMLButtonControlFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
#endif
}
#ifdef DEBUG_rodsXXXX

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

@ -217,54 +217,6 @@ pre[wrap], pre[cols], pre[width] {
}
/* Temporary - Test of full time Standard mode for forms Bug 91602
input[type="text"] {
padding: 1px 0 0 0;
}
input[type="radio"] {
margin: 2px 5px 4px 3px;
vertical-align: bottom;
}
input[type="checkbox"] {
margin: 3px 4px 3px 3px;
vertical-align: bottom;
}
button,
input[type="reset"],
input[type="button"],
input[type="submit"] {
vertical-align: bottom;
}
td select[size] {
margin-top: 0px;
margin-bottom: 1px;
}
td select, td select[size="1"] {
margin-top: 2px;
margin-bottom: 2px;
}
td input[type="text"], input[type="password"] {
margin-top: 1px;
margin-bottom: 1px;
}
td input[type="checkbox"],
td input[type="radio"] {
margin-bottom: 1px;
}
td textarea {
margin-top: 1px;
margin-bottom: 2px;
}
*/
/* Quirk: HRs avoid floats (b=18754) */
hr {

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

@ -90,11 +90,6 @@ static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
// it a synonym for "soft"
#define kTextControl_Wrap_Off "OFF"
// Temporary - Test of full time Standard mode for forms (Bug 91602)
#include "nsIPref.h"
PRPackedBool nsFormControlHelper::mCompatFirstTime = PR_TRUE;
PRPackedBool nsFormControlHelper::mUseEitherMode = PR_FALSE;
MOZ_DECL_CTOR_COUNTER(nsFormControlHelper)
@ -156,22 +151,6 @@ void nsFormControlHelper::GetBoolString(const PRBool aValue,
}
nsCompatibility
nsFormControlHelper::GetRepChars(nsIPresContext* aPresContext, char& char1, char& char2)
{
nsCompatibility mode;
nsFormControlHelper::GetFormCompatibilityMode(aPresContext, mode);
if (eCompatibility_Standard == mode) {
char1 = 'W';
char2 = 'w';
return eCompatibility_Standard;
} else {
char1 = 'W';
char2 = 'w';
return eCompatibility_NavQuirks;
}
}
nsresult nsFormControlHelper::GetFrameFontFM(nsIPresContext* aPresContext,
nsIFormControlFrame * aFrame,
nsIFontMetrics** aFontMet)
@ -259,7 +238,7 @@ nsFormControlHelper::CalcNavQuirkSizing(nsIPresContext* aPresContext,
maxCharWidth = NSToCoordRound(maxCharWidth * t2p);
char char1, char2;
GetRepChars(aPresContext, char1, char2);
GetRepChars(char1, char2);
nscoord char1Width, char2Width;
aRendContext->GetWidth(char1, char1Width);
@ -379,16 +358,12 @@ nsFormControlHelper::GetTextSize(nsIPresContext* aPresContext, nsIFormControlFra
}
char char1, char2;
nsCompatibility mode = GetRepChars(aPresContext, char1, char2);
GetRepChars(char1, char2);
nscoord char1Width, char2Width;
aRendContext->GetWidth(char1, char1Width);
aRendContext->GetWidth(char2, char2Width);
if (eCompatibility_Standard == mode) {
return ((char1Width + char2Width) / 2) + 1;
} else {
return (char1Width + char2Width) / 2;
}
return ((char1Width + char2Width) / 2) + 1;
}
nscoord
@ -398,7 +373,7 @@ nsFormControlHelper::GetTextSize(nsIPresContext* aPresContext, nsIFormControlFra
{
nsAutoString val;
char char1, char2;
GetRepChars(aPresContext, char1, char2);
GetRepChars(char1, char2);
int i;
for (i = 0; i < aNumChars; i+=2) {
val.Append(PRUnichar(char1));
@ -472,9 +447,6 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
}
#endif
nsCompatibility qMode;
nsFormControlHelper::GetFormCompatibilityMode(aPresContext, qMode);
// determine the width, char height, row height
if (NS_CONTENT_ATTR_HAS_VALUE == colStatus) { // col attr will provide width
PRInt32 col = ((colAttr.GetUnit() == eHTMLUnit_Pixel) ? colAttr.GetPixelValue() : colAttr.GetIntValue());
@ -486,23 +458,9 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
aDesiredSize.width = NSIntPixelsToTwips(col, p2t);
} else {
col = (col <= 0) ? 1 : col; // XXX why a default of 1 char, why hide it
if (eCompatibility_NavQuirks == qMode) {
nsCOMPtr<nsIFontMetrics> fontMet;
nsresult res = GetFrameFontFM(aPresContext, aFrame, getter_AddRefs(fontMet));
if (NS_SUCCEEDED(res) && fontMet) {
aRendContext->SetFont(fontMet);
aSpec.mColDefaultSize = col;
charWidth = CalcNavQuirkSizing(aPresContext, aRendContext, fontMet,
aFrame, aSpec, aDesiredSize);
} else {
charWidth = GetTextSize(aPresContext, aFrame, col, aDesiredSize, aRendContext);
}
}
}
if (eCompatibility_Standard == qMode) {
if (aSpec.mColSizeAttrInPixels) {
aWidthExplicit = PR_TRUE;
}
if (aSpec.mColSizeAttrInPixels) {
aWidthExplicit = PR_TRUE;
}
aMinSize.width = aDesiredSize.width;
} else {
@ -515,22 +473,7 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
charWidth = GetTextSize(aPresContext, aFrame, 1, aDesiredSize, aRendContext);
aDesiredSize.width = aSpec.mColDefaultSize;
} else { // use default width in num characters
if (eCompatibility_NavQuirks == qMode) {
nsCOMPtr<nsIFontMetrics> fontMet;
nsresult res = GetFrameFontFM(aPresContext, aFrame, getter_AddRefs(fontMet));
if (NS_SUCCEEDED(res) && fontMet) {
aRendContext->SetFont(fontMet);
// this passes in a
charWidth = CalcNavQuirkSizing(aPresContext, aRendContext, fontMet,
aFrame, aSpec, aDesiredSize);
} else {
NS_ASSERTION(fontMet, "Couldn't get Font Metrics");
aDesiredSize.width = 300; // arbitrary values
aDesiredSize.width = 1500;
}
} else {
charWidth = GetTextSize(aPresContext, aFrame, aSpec.mColDefaultSize, aDesiredSize, aRendContext);
}
charWidth = GetTextSize(aPresContext, aFrame, aSpec.mColDefaultSize, aDesiredSize, aRendContext);
}
aMinSize.width = aDesiredSize.width;
if (CSS_NOTSET != aCSSSize.width) { // css provides width
@ -545,25 +488,23 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
aMinSize.height = aDesiredSize.height;
// determine the height
if (eCompatibility_Standard == qMode) {
nsHTMLValue rowAttr;
nsresult rowStatus = NS_CONTENT_ATTR_NOT_THERE;
if (nsnull != aSpec.mRowSizeAttr) {
rowStatus = hContent->GetHTMLAttribute(aSpec.mRowSizeAttr, rowAttr);
}
if (NS_CONTENT_ATTR_HAS_VALUE == rowStatus) { // row attr will provide height
PRInt32 rowAttrInt = ((rowAttr.GetUnit() == eHTMLUnit_Pixel)
? rowAttr.GetPixelValue() : rowAttr.GetIntValue());
numRows = (rowAttrInt > 0) ? rowAttrInt : 1;
aDesiredSize.height = aDesiredSize.height * numRows;
} else {
aDesiredSize.height = aDesiredSize.height * aSpec.mRowDefaultSize;
if (CSS_NOTSET != aCSSSize.height) { // css provides height
NS_ASSERTION(aCSSSize.height > 0, "form control's computed height is <= 0");
if (NS_INTRINSICSIZE != aCSSSize.height) {
aDesiredSize.height = PR_MAX(aDesiredSize.height,aCSSSize.height);
aHeightExplicit = PR_TRUE;
}
nsHTMLValue rowAttr;
nsresult rowStatus = NS_CONTENT_ATTR_NOT_THERE;
if (nsnull != aSpec.mRowSizeAttr) {
rowStatus = hContent->GetHTMLAttribute(aSpec.mRowSizeAttr, rowAttr);
}
if (NS_CONTENT_ATTR_HAS_VALUE == rowStatus) { // row attr will provide height
PRInt32 rowAttrInt = ((rowAttr.GetUnit() == eHTMLUnit_Pixel)
? rowAttr.GetPixelValue() : rowAttr.GetIntValue());
numRows = (rowAttrInt > 0) ? rowAttrInt : 1;
aDesiredSize.height = aDesiredSize.height * numRows;
} else {
aDesiredSize.height = aDesiredSize.height * aSpec.mRowDefaultSize;
if (CSS_NOTSET != aCSSSize.height) { // css provides height
NS_ASSERTION(aCSSSize.height > 0, "form control's computed height is <= 0");
if (NS_INTRINSICSIZE != aCSSSize.height) {
aDesiredSize.height = PR_MAX(aDesiredSize.height,aCSSSize.height);
aHeightExplicit = PR_TRUE;
}
}
}
@ -579,7 +520,6 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
}
// this handles all of the input types rather than having them do it.
nsresult
nsFormControlHelper::GetFont(nsIFormControlFrame * aFormFrame,
nsIPresContext* aPresContext,
@ -588,69 +528,7 @@ nsFormControlHelper::GetFont(nsIFormControlFrame * aFormFrame,
{
const nsStyleFont* styleFont = (const nsStyleFont*)aStyleContext->GetStyleData(eStyleStruct_Font);
nsWidgetRendering m;
aPresContext->GetWidgetRenderingMode(&m);
// only add in padding if we are not Gfx, excluding the text widgets
PRBool requiresWidget = PR_FALSE;
aFormFrame->RequiresWidget(requiresWidget);
PRInt32 type;
aFormFrame->GetType(&type);
if (type!=NS_FORM_INPUT_TEXT &&
type!=NS_FORM_TEXTAREA &&
type!=NS_FORM_INPUT_PASSWORD) {
if (PR_TRUE != requiresWidget && eWidgetRendering_Gfx == m) {
aFont = &styleFont->mFont;
return NS_OK;
}
}
nsCompatibility mode;
nsFormControlHelper::GetFormCompatibilityMode(aPresContext, mode);
if (eCompatibility_Standard == mode) {
aFont = &styleFont->mFont;
return NS_OK;
}
switch (type) {
case NS_FORM_INPUT_TEXT:
case NS_FORM_TEXTAREA:
case NS_FORM_INPUT_PASSWORD:
aFont = &styleFont->mFont;
break;
case NS_FORM_INPUT_BUTTON:
case NS_FORM_INPUT_SUBMIT:
case NS_FORM_INPUT_RESET:
case NS_FORM_SELECT:
NS_ASSERTION(0, "getting the font here has been predicated");
#if 0
if ((styleFont->mFlags & NS_STYLE_FONT_FACE_EXPLICIT) ||
(styleFont->mFlags & NS_STYLE_FONT_SIZE_EXPLICIT)) {
aFont = styleFont->mFixedFont;
aFont.weight = NS_FONT_WEIGHT_NORMAL; // always normal weight
aFont.size = styleFont->mFont.size; // normal font size
if (0 == (styleFont->mFlags & NS_STYLE_FONT_FACE_EXPLICIT)) {
aFont.name = "Arial"; // XXX windows specific font
}
} else {
// use arial, scaled down one HTML size
// italics, decoration & variant(?) get used
aFont = styleFont->mFont;
aFont.name = "Arial"; // XXX windows specific font
aFont.weight = NS_FONT_WEIGHT_NORMAL;
const nsFont& normal = aPresContext->GetDefaultFontDeprecated();
PRInt32 scaler;
aPresContext->GetFontScaler(&scaler);
float scaleFactor = nsStyleUtil::GetScalingFactor(scaler);
PRInt32 fontIndex = nsStyleUtil::FindNextSmallerFontSize(aFont.size, (PRInt32)normal.size, scaleFactor, aPresContext);
aFont.size = nsStyleUtil::CalcFontPointSize(fontIndex, (PRInt32)normal.size, scaleFactor, aPresContext);
}
#endif
break;
}
aFont = &styleFont->mFont;
return NS_OK;
}
@ -999,31 +877,6 @@ nsFormControlHelper::DoManualSubmitOrReset(nsIPresContext* aPresContext,
return result;
}
// Temporary - Test of full time Standard mode for forms (Bug 91602)
//
void nsFormControlHelper::GetFormCompatibilityMode(nsIPresContext* aPresContext,
nsCompatibility& aCompatMode)
{
if (mCompatFirstTime) {
nsCOMPtr<nsIPref> prefService(do_GetService(NS_PREF_CONTRACTID));
if (prefService) {
PRBool useEitherMode;
if (NS_SUCCEEDED(prefService->GetBoolPref("layout.forms.use_standard_or_quirks", &useEitherMode))) {
if (useEitherMode) {
mUseEitherMode = PR_TRUE;
}
}
}
mCompatFirstTime = PR_FALSE;
}
if (mUseEitherMode) {
aPresContext->GetCompatibilityMode(&aCompatMode);
} else {
aCompatMode = eCompatibility_Standard;
}
}
nsresult
nsFormControlHelper::Reset(nsIFrame* aFrame, nsIPresContext* aPresContext)
{

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

@ -133,6 +133,7 @@ public:
PRInt32 aNumChars, nsSize& aSize,
nsIRenderingContext *aRendContext);
// XXX This could be removed now that we no longer have form quirks.
static nsresult GetFont(nsIFormControlFrame * aFormFrame,
nsIPresContext* aPresContext,
nsIStyleContext * aStyleContext,
@ -184,7 +185,10 @@ public:
static void GetBoolString(const PRBool aValue, nsAString& aResult);
static nsCompatibility GetRepChars(nsIPresContext* aPresContext, char& char1, char& char2);
static void GetRepChars(char& char1, char& char2) {
char1 = 'W';
char2 = 'w';
}
// wrap can be one of these three values.
typedef enum {
@ -357,15 +361,10 @@ public:
nsIStyleContext* aStyleContext, nsString& aLabel,
nsIFrame* aForFrame);
static void GetFormCompatibilityMode(nsIPresContext* aPresContext, nsCompatibility& mCompatMode);
protected:
nsFormControlHelper();
virtual ~nsFormControlHelper();
// Temporary - Test of full time Standard mode for forms (Bug 91602)
static PRPackedBool mCompatFirstTime;
static PRPackedBool mUseEitherMode;
};
#endif

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

@ -578,37 +578,33 @@ nsGfxButtonControlFrame::Reflow(nsIPresContext* aPresContext,
} else { // Normal reflow.
nsCompatibility mode = eCompatibility_NavQuirks;
//nsFormControlHelper::GetFormCompatibilityMode(aPresContext, mode);
if (mode == eCompatibility_NavQuirks) {
// nsHTMLButtonControlFrame::Reflow registers it for Standard Mode
// and sets up mPresContext
if (eReflowReason_Initial == aReflowState.reason) {
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
}
// Do NavQuirks Sizing and layout
rv = DoNavQuirksReflow(aPresContext, aDesiredSize, aReflowState, aStatus);
// Make sure we obey min/max-width and min/max-height
if (aDesiredSize.width > aReflowState.mComputedMaxWidth) {
aDesiredSize.width = aReflowState.mComputedMaxWidth;
}
if (aDesiredSize.width < aReflowState.mComputedMinWidth) {
aDesiredSize.width = aReflowState.mComputedMinWidth;
}
if (aDesiredSize.height > aReflowState.mComputedMaxHeight) {
aDesiredSize.height = aReflowState.mComputedMaxHeight;
}
if (aDesiredSize.height < aReflowState.mComputedMinHeight) {
aDesiredSize.height = aReflowState.mComputedMinHeight;
}
} else {
// Do Standard mode sizing and layout
rv = nsHTMLButtonControlFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
#if 1
// nsHTMLButtonControlFrame::Reflow registers it for Standard Mode
// and sets up mPresContext
if (eReflowReason_Initial == aReflowState.reason) {
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
}
// Do NavQuirks Sizing and layout
rv = DoNavQuirksReflow(aPresContext, aDesiredSize, aReflowState, aStatus);
// Make sure we obey min/max-width and min/max-height
if (aDesiredSize.width > aReflowState.mComputedMaxWidth) {
aDesiredSize.width = aReflowState.mComputedMaxWidth;
}
if (aDesiredSize.width < aReflowState.mComputedMinWidth) {
aDesiredSize.width = aReflowState.mComputedMinWidth;
}
if (aDesiredSize.height > aReflowState.mComputedMaxHeight) {
aDesiredSize.height = aReflowState.mComputedMaxHeight;
}
if (aDesiredSize.height < aReflowState.mComputedMinHeight) {
aDesiredSize.height = aReflowState.mComputedMinHeight;
}
#else
// Do Standard mode sizing and layout
rv = nsHTMLButtonControlFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
#endif
}
#ifdef DEBUG_rodsXXXX

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

@ -1736,121 +1736,7 @@ nsGfxTextControlFrame2::CalculateSizeStandard (nsIPresContext* aPresContex
PRInt32
nsGfxTextControlFrame2::CalculateSizeNavQuirks (nsIPresContext* aPresContext,
nsIRenderingContext* aRendContext,
nsIFormControlFrame* aFrame,
nsInputDimensionSpec& aSpec,
nsSize& aDesiredSize,
nsSize& aMinSize,
nscoord& aRowHeight,
nsMargin& aBorder,
nsMargin& aPadding,
PRBool aIsUsingDefSize)
{
nscoord charWidth = 0;
aDesiredSize.width = CSS_NOTSET;
aDesiredSize.height = CSS_NOTSET;
// Quirks does not use rowAttr
nsHTMLValue colAttr;
nsresult colStatus;
nsHTMLValue rowAttr;
nsresult rowStatus;
if (NS_ERROR_FAILURE == GetColRowSizeAttr(aFrame,
aSpec.mColSizeAttr, colAttr, colStatus,
aSpec.mRowSizeAttr, rowAttr, rowStatus)) {
return 0;
}
// Get the Font Metrics for the Control
// without it we can't calculate the size
nsCOMPtr<nsIFontMetrics> fontMet;
nsresult res = nsFormControlHelper::GetFrameFontFM(aPresContext, aFrame, getter_AddRefs(fontMet));
if (NS_SUCCEEDED(res) && fontMet) {
aRendContext->SetFont(fontMet);
// Calculate the min size of the text control as one char
// save the current default col size
nscoord tmpCol = aSpec.mColDefaultSize;
aSpec.mColDefaultSize = 1;
charWidth = nsFormControlHelper::CalcNavQuirkSizing(aPresContext,
aRendContext, fontMet,
aFrame, aSpec, aDesiredSize);
// set the default col size back
aMinSize.width = aDesiredSize.width;
aMinSize.height = aDesiredSize.height;
aSpec.mColDefaultSize = tmpCol;
// Figure out the number of columns
// and set that as the default col size
if (NS_CONTENT_ATTR_HAS_VALUE == colStatus) { // col attr will provide width
PRInt32 col = ((colAttr.GetUnit() == eHTMLUnit_Pixel) ? colAttr.GetPixelValue() : colAttr.GetIntValue());
col = (col <= 0) ? 1 : col; // XXX why a default of 1 char, why hide it
aSpec.mColDefaultSize = col;
}
charWidth = nsFormControlHelper::CalcNavQuirkSizing(aPresContext,
aRendContext, fontMet,
aFrame, aSpec, aDesiredSize);
aDesiredSize.height = aDesiredSize.height * aSpec.mRowDefaultSize;
} else {
NS_ASSERTION(fontMet, "Couldn't get Font Metrics");
aDesiredSize.width = 300; // arbitrary values
aDesiredSize.width = 1500;
}
aRowHeight = aDesiredSize.height;
aMinSize.height = aDesiredSize.height;
// if we are not using the default size
// then make the minimum size the size we want to be
if (!aIsUsingDefSize) {
aMinSize.width = aDesiredSize.width;
aMinSize.height = aDesiredSize.height;
}
PRInt32 numRows = (aRowHeight > 0) ? (aDesiredSize.height / aRowHeight) : 0;
return numRows;
}
//------------------------------------------------------------------
NS_IMETHODIMP
nsGfxTextControlFrame2::ReflowNavQuirks(nsIPresContext* aPresContext,
nsSize& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus,
nsMargin& aBorder,
nsMargin& aPadding)
{
PRBool usingDefaultSize = PR_FALSE;
PRInt32 ignore;
PRInt32 type;
GetType(&type);
if ((NS_FORM_INPUT_TEXT == type) || (NS_FORM_INPUT_PASSWORD == type)) {
PRInt32 width = 0;
if (NS_CONTENT_ATTR_HAS_VALUE != GetSizeFromContent(&width)) {
width = GetDefaultColumnWidth();
usingDefaultSize = PR_TRUE;
}
nsInputDimensionSpec textSpec(nsnull, PR_FALSE, nsnull,
nsnull, width,
PR_FALSE, nsnull, 1);
CalculateSizeNavQuirks(aPresContext, aReflowState.rendContext, this,
textSpec, aDesiredSize, mMinSize, ignore, aBorder, aPadding, usingDefaultSize);
} else {
nsInputDimensionSpec areaSpec(nsHTMLAtoms::cols, PR_FALSE, nsnull,
nsnull, GetDefaultColumnWidth(),
PR_FALSE, nsHTMLAtoms::rows, 1);
CalculateSizeNavQuirks(aPresContext, aReflowState.rendContext, this,
areaSpec, aDesiredSize, mMinSize, ignore, aBorder, aPadding, usingDefaultSize);
}
return NS_OK;
}
NS_IMETHODIMP
nsGfxTextControlFrame2::CreateFrameFor(nsIPresContext* aPresContext,
nsIContent * aContent,
@ -2399,10 +2285,6 @@ nsGfxTextControlFrame2::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
if (mState & NS_FRAME_FIRST_REFLOW)
mNotifyOnInput = PR_TRUE;//its ok to notify now. all has been prepared.
nsCompatibility mode;
nsFormControlHelper::GetFormCompatibilityMode(aPresContext, mode);
PRBool navQuirksMode = eCompatibility_NavQuirks == mode && nameSpaceID == kNameSpaceID_HTML;
nsReflowStatus aStatus;
nsMargin border;
border.SizeTo(0, 0, 0, 0);
@ -2418,11 +2300,7 @@ nsGfxTextControlFrame2::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
paddingStyle->CalcPaddingFor(this, padding);
nsresult rv;
if (navQuirksMode) {
rv = ReflowNavQuirks(aPresContext, aSize, *aReflowState, aStatus, border, padding);
} else {
rv = ReflowStandard(aPresContext, aSize, *aReflowState, aStatus, border, padding);
}
rv = ReflowStandard(aPresContext, aSize, *aReflowState, aStatus, border, padding);
AddInset(aSize);
mPrefSize = aSize;

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

@ -225,25 +225,6 @@ protected:
nsMargin& aPadding,
PRBool aIsUsingDefSize);
PRInt32 CalculateSizeNavQuirks (nsIPresContext* aPresContext,
nsIRenderingContext* aRendContext,
nsIFormControlFrame* aFrame,
nsInputDimensionSpec& aSpec,
nsSize& aDesiredSize,
nsSize& aMinSize,
nscoord& aRowHeight,
nsMargin& aBorder,
nsMargin& aPadding,
PRBool aIsUsingDefSize);
NS_IMETHOD ReflowNavQuirks(nsIPresContext* aPresContext,
nsSize& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus,
nsMargin& aBorder,
nsMargin& aPadding);
NS_IMETHOD CreateFrameFor(nsIPresContext* aPresContext,
nsIContent * aContent,
nsIFrame** aFrame);

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

@ -40,6 +40,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nscore.h"
#include "nsIServiceManager.h"
#include "nsRuleNode.h"
#include "nsIDeviceContext.h"
#include "nsILookAndFeel.h"
@ -52,10 +53,6 @@
#include "nsITheme.h"
#include "pldhash.h"
// Temporary - Test of full time Standard mode for forms
#include "nsIPref.h"
#include "nsIServiceManager.h"
/*
* For storage of an |nsRuleNode|'s children in a linked list.
*/
@ -1864,22 +1861,6 @@ SetFont(nsIPresContext* aPresContext, nsIStyleContext* aContext,
case NS_STYLE_FONT_THEME: sysID = eSystemFont_Theme; break;
}
nsCompatibility mode = eCompatibility_Standard;
if (sysID == eSystemFont_Field ||
sysID == eSystemFont_List ||
sysID == eSystemFont_Button) {
nsCOMPtr<nsIPref> prefService(do_GetService(NS_PREF_CONTRACTID));
if (prefService) {
PRBool useEitherMode;
if (NS_SUCCEEDED(prefService->GetBoolPref("layout.forms.use_standard_or_quirks", &useEitherMode))) {
if (useEitherMode) {
aPresContext->GetCompatibilityMode(&mode);
}
}
}
}
nsCOMPtr<nsIDeviceContext> dc;
aPresContext->GetDeviceContext(getter_AddRefs(dc));
if (dc) {
@ -1891,35 +1872,15 @@ SetFont(nsIPresContext* aPresContext, nsIStyleContext* aContext,
aFont->mSize = aFont->mFont.size; // this becomes our cascading size
}
// NavQuirks uses sans-serif instead of whatever the native font is
#if defined(XP_MAC) || defined(XP_MACOSX)
if (eCompatibility_NavQuirks == mode) {
switch (sysID) {
case eSystemFont_Field:
case eSystemFont_List:
aFont->mFont.name.Assign(NS_LITERAL_STRING("monospace"));
aFont->mSize = defaultFixedFont->size;
break;
case eSystemFont_Button:
aFont->mFont.name.Assign(NS_LITERAL_STRING("serif"));
aFont->mSize = defaultVariableFont->size;
break;
}
}
#endif
// XXXldb All of this platform-specific stuff should be in the
// nsIDeviceContext implementations, not here.
#if defined(XP_OS2)
switch (sysID) {
case eSystemFont_List:
case eSystemFont_Button:
aFont->mFont.name = defaultVariableFont->name;
break;
case eSystemFont_Field:
if (eCompatibility_NavQuirks == mode)
aFont->mFont.name.Assign(NS_LITERAL_STRING("monospace"));
else
aFont->mFont.name = defaultVariableFont->name;
break;
switch (sysID) {
case eSystemFont_List:
case eSystemFont_Button:
case eSystemFont_Field:
aFont->mFont.name = defaultVariableFont->name;
break;
}
#endif
@ -1932,65 +1893,19 @@ SetFont(nsIPresContext* aPresContext, nsIStyleContext* aContext,
//
switch (sysID) {
// Fields (text fields)
//
// For NavQuirks:
// We always use the monospace font and whatever
// the "fixed" font size this that is set by the browser
//
// For Standard/Strict Mode:
// Button and Selects (listboxes/comboboxes)
// We use whatever font is defined by the system. Which it appears
// (and the assumption is) it is always a proportional font. Then we
// always use 2 points smaller than what the browser has defined as
// the default proportional font.
case eSystemFont_Field:
if (eCompatibility_NavQuirks == mode) {
aFont->mFont.name.Assign(NS_LITERAL_STRING("monospace"));
aFont->mSize = defaultFixedFont->size;
} else {
// Assumption: system defined font is proportional
aFont->mSize = PR_MAX(defaultVariableFont->size - NSIntPointsToTwips(2), 0);
}
break;
//
// Button and Selects (listboxes/comboboxes)
//
// For NavQuirks:
// We always use the sans-serif font and 2 point point sizes smaller
// that whatever the "proportional" font size this that is set by the browser
//
// For Standard/Strict Mode:
// We use whatever font is defined by the system. Which it appears
// (and the assumption is) it is always a proportional font. Then we
// always use 2 points smaller than what the browser has defined as
// the default proportional font.
case eSystemFont_Button:
case eSystemFont_List:
if (eCompatibility_NavQuirks == mode) {
aFont->mFont.name.Assign(NS_LITERAL_STRING("sans-serif"));
}
// Assumption: system defined font is proportional
aFont->mSize = PR_MAX(defaultVariableFont->size - NSIntPointsToTwips(2), 0);
break;
}
#endif
#if defined(XP_UNIX) && !defined(XP_MACOSX)
if (eCompatibility_NavQuirks == mode) {
switch (sysID) {
case eSystemFont_Field:
aFont->mFont.name.Assign(NS_LITERAL_STRING("monospace"));
aFont->mSize = defaultFixedFont->size;
break;
case eSystemFont_Button:
case eSystemFont_List:
aFont->mFont.name.Assign(NS_LITERAL_STRING("serif"));
aFont->mSize = defaultVariableFont->size;
break;
default:
NS_ERROR("unexpected SID");
}
}
#endif
}
else if (eCSSUnit_Inherit == aFontData.mFamily.GetUnit()) {
aInherited = PR_TRUE;

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

@ -217,54 +217,6 @@ pre[wrap], pre[cols], pre[width] {
}
/* Temporary - Test of full time Standard mode for forms Bug 91602
input[type="text"] {
padding: 1px 0 0 0;
}
input[type="radio"] {
margin: 2px 5px 4px 3px;
vertical-align: bottom;
}
input[type="checkbox"] {
margin: 3px 4px 3px 3px;
vertical-align: bottom;
}
button,
input[type="reset"],
input[type="button"],
input[type="submit"] {
vertical-align: bottom;
}
td select[size] {
margin-top: 0px;
margin-bottom: 1px;
}
td select, td select[size="1"] {
margin-top: 2px;
margin-bottom: 2px;
}
td input[type="text"], input[type="password"] {
margin-top: 1px;
margin-bottom: 1px;
}
td input[type="checkbox"],
td input[type="radio"] {
margin-bottom: 1px;
}
td textarea {
margin-top: 1px;
margin-bottom: 2px;
}
*/
/* Quirk: HRs avoid floats (b=18754) */
hr {