зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
f940144626
Коммит
3e64376a4b
|
@ -40,6 +40,7 @@
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
|
#include "nsIServiceManager.h"
|
||||||
#include "nsRuleNode.h"
|
#include "nsRuleNode.h"
|
||||||
#include "nsIDeviceContext.h"
|
#include "nsIDeviceContext.h"
|
||||||
#include "nsILookAndFeel.h"
|
#include "nsILookAndFeel.h"
|
||||||
|
@ -52,10 +53,6 @@
|
||||||
#include "nsITheme.h"
|
#include "nsITheme.h"
|
||||||
#include "pldhash.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.
|
* 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;
|
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;
|
nsCOMPtr<nsIDeviceContext> dc;
|
||||||
aPresContext->GetDeviceContext(getter_AddRefs(dc));
|
aPresContext->GetDeviceContext(getter_AddRefs(dc));
|
||||||
if (dc) {
|
if (dc) {
|
||||||
|
@ -1891,33 +1872,13 @@ SetFont(nsIPresContext* aPresContext, nsIStyleContext* aContext,
|
||||||
aFont->mSize = aFont->mFont.size; // this becomes our cascading size
|
aFont->mSize = aFont->mFont.size; // this becomes our cascading size
|
||||||
}
|
}
|
||||||
|
|
||||||
// NavQuirks uses sans-serif instead of whatever the native font is
|
// XXXldb All of this platform-specific stuff should be in the
|
||||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
// nsIDeviceContext implementations, not here.
|
||||||
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
|
|
||||||
|
|
||||||
#if defined(XP_OS2)
|
#if defined(XP_OS2)
|
||||||
switch (sysID) {
|
switch (sysID) {
|
||||||
case eSystemFont_List:
|
case eSystemFont_List:
|
||||||
case eSystemFont_Button:
|
case eSystemFont_Button:
|
||||||
aFont->mFont.name = defaultVariableFont->name;
|
|
||||||
break;
|
|
||||||
case eSystemFont_Field:
|
case eSystemFont_Field:
|
||||||
if (eCompatibility_NavQuirks == mode)
|
|
||||||
aFont->mFont.name.Assign(NS_LITERAL_STRING("monospace"));
|
|
||||||
else
|
|
||||||
aFont->mFont.name = defaultVariableFont->name;
|
aFont->mFont.name = defaultVariableFont->name;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1932,65 +1893,19 @@ SetFont(nsIPresContext* aPresContext, nsIStyleContext* aContext,
|
||||||
//
|
//
|
||||||
switch (sysID) {
|
switch (sysID) {
|
||||||
// Fields (text fields)
|
// 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:
|
|
||||||
// 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)
|
// 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
|
// We use whatever font is defined by the system. Which it appears
|
||||||
// (and the assumption is) it is always a proportional font. Then we
|
// (and the assumption is) it is always a proportional font. Then we
|
||||||
// always use 2 points smaller than what the browser has defined as
|
// always use 2 points smaller than what the browser has defined as
|
||||||
// the default proportional font.
|
// the default proportional font.
|
||||||
|
case eSystemFont_Field:
|
||||||
case eSystemFont_Button:
|
case eSystemFont_Button:
|
||||||
case eSystemFont_List:
|
case eSystemFont_List:
|
||||||
if (eCompatibility_NavQuirks == mode) {
|
|
||||||
aFont->mFont.name.Assign(NS_LITERAL_STRING("sans-serif"));
|
|
||||||
}
|
|
||||||
// Assumption: system defined font is proportional
|
// Assumption: system defined font is proportional
|
||||||
aFont->mSize = PR_MAX(defaultVariableFont->size - NSIntPointsToTwips(2), 0);
|
aFont->mSize = PR_MAX(defaultVariableFont->size - NSIntPointsToTwips(2), 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#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()) {
|
else if (eCSSUnit_Inherit == aFontData.mFamily.GetUnit()) {
|
||||||
aInherited = PR_TRUE;
|
aInherited = PR_TRUE;
|
||||||
|
|
|
@ -90,11 +90,6 @@ static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||||
// it a synonym for "soft"
|
// it a synonym for "soft"
|
||||||
#define kTextControl_Wrap_Off "OFF"
|
#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)
|
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,
|
nsresult nsFormControlHelper::GetFrameFontFM(nsIPresContext* aPresContext,
|
||||||
nsIFormControlFrame * aFrame,
|
nsIFormControlFrame * aFrame,
|
||||||
nsIFontMetrics** aFontMet)
|
nsIFontMetrics** aFontMet)
|
||||||
|
@ -259,7 +238,7 @@ nsFormControlHelper::CalcNavQuirkSizing(nsIPresContext* aPresContext,
|
||||||
maxCharWidth = NSToCoordRound(maxCharWidth * t2p);
|
maxCharWidth = NSToCoordRound(maxCharWidth * t2p);
|
||||||
|
|
||||||
char char1, char2;
|
char char1, char2;
|
||||||
GetRepChars(aPresContext, char1, char2);
|
GetRepChars(char1, char2);
|
||||||
|
|
||||||
nscoord char1Width, char2Width;
|
nscoord char1Width, char2Width;
|
||||||
aRendContext->GetWidth(char1, char1Width);
|
aRendContext->GetWidth(char1, char1Width);
|
||||||
|
@ -379,16 +358,12 @@ nsFormControlHelper::GetTextSize(nsIPresContext* aPresContext, nsIFormControlFra
|
||||||
}
|
}
|
||||||
|
|
||||||
char char1, char2;
|
char char1, char2;
|
||||||
nsCompatibility mode = GetRepChars(aPresContext, char1, char2);
|
GetRepChars(char1, char2);
|
||||||
nscoord char1Width, char2Width;
|
nscoord char1Width, char2Width;
|
||||||
aRendContext->GetWidth(char1, char1Width);
|
aRendContext->GetWidth(char1, char1Width);
|
||||||
aRendContext->GetWidth(char2, char2Width);
|
aRendContext->GetWidth(char2, char2Width);
|
||||||
|
|
||||||
if (eCompatibility_Standard == mode) {
|
|
||||||
return ((char1Width + char2Width) / 2) + 1;
|
return ((char1Width + char2Width) / 2) + 1;
|
||||||
} else {
|
|
||||||
return (char1Width + char2Width) / 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord
|
nscoord
|
||||||
|
@ -398,7 +373,7 @@ nsFormControlHelper::GetTextSize(nsIPresContext* aPresContext, nsIFormControlFra
|
||||||
{
|
{
|
||||||
nsAutoString val;
|
nsAutoString val;
|
||||||
char char1, char2;
|
char char1, char2;
|
||||||
GetRepChars(aPresContext, char1, char2);
|
GetRepChars(char1, char2);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < aNumChars; i+=2) {
|
for (i = 0; i < aNumChars; i+=2) {
|
||||||
val.Append(PRUnichar(char1));
|
val.Append(PRUnichar(char1));
|
||||||
|
@ -472,9 +447,6 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsCompatibility qMode;
|
|
||||||
nsFormControlHelper::GetFormCompatibilityMode(aPresContext, qMode);
|
|
||||||
|
|
||||||
// determine the width, char height, row height
|
// determine the width, char height, row height
|
||||||
if (NS_CONTENT_ATTR_HAS_VALUE == colStatus) { // col attr will provide width
|
if (NS_CONTENT_ATTR_HAS_VALUE == colStatus) { // col attr will provide width
|
||||||
PRInt32 col = ((colAttr.GetUnit() == eHTMLUnit_Pixel) ? colAttr.GetPixelValue() : colAttr.GetIntValue());
|
PRInt32 col = ((colAttr.GetUnit() == eHTMLUnit_Pixel) ? colAttr.GetPixelValue() : colAttr.GetIntValue());
|
||||||
|
@ -486,24 +458,10 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
|
||||||
aDesiredSize.width = NSIntPixelsToTwips(col, p2t);
|
aDesiredSize.width = NSIntPixelsToTwips(col, p2t);
|
||||||
} else {
|
} else {
|
||||||
col = (col <= 0) ? 1 : col; // XXX why a default of 1 char, why hide it
|
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) {
|
if (aSpec.mColSizeAttrInPixels) {
|
||||||
aWidthExplicit = PR_TRUE;
|
aWidthExplicit = PR_TRUE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
aMinSize.width = aDesiredSize.width;
|
aMinSize.width = aDesiredSize.width;
|
||||||
} else {
|
} else {
|
||||||
// set aDesiredSize for height calculation below. CSS may override width
|
// set aDesiredSize for height calculation below. CSS may override width
|
||||||
|
@ -515,23 +473,8 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
|
||||||
charWidth = GetTextSize(aPresContext, aFrame, 1, aDesiredSize, aRendContext);
|
charWidth = GetTextSize(aPresContext, aFrame, 1, aDesiredSize, aRendContext);
|
||||||
aDesiredSize.width = aSpec.mColDefaultSize;
|
aDesiredSize.width = aSpec.mColDefaultSize;
|
||||||
} else { // use default width in num characters
|
} 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;
|
aMinSize.width = aDesiredSize.width;
|
||||||
if (CSS_NOTSET != aCSSSize.width) { // css provides width
|
if (CSS_NOTSET != aCSSSize.width) { // css provides width
|
||||||
NS_ASSERTION(aCSSSize.width >= 0, "form control's computed width is < 0");
|
NS_ASSERTION(aCSSSize.width >= 0, "form control's computed width is < 0");
|
||||||
|
@ -545,7 +488,6 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
|
||||||
aMinSize.height = aDesiredSize.height;
|
aMinSize.height = aDesiredSize.height;
|
||||||
|
|
||||||
// determine the height
|
// determine the height
|
||||||
if (eCompatibility_Standard == qMode) {
|
|
||||||
nsHTMLValue rowAttr;
|
nsHTMLValue rowAttr;
|
||||||
nsresult rowStatus = NS_CONTENT_ATTR_NOT_THERE;
|
nsresult rowStatus = NS_CONTENT_ATTR_NOT_THERE;
|
||||||
if (nsnull != aSpec.mRowSizeAttr) {
|
if (nsnull != aSpec.mRowSizeAttr) {
|
||||||
|
@ -566,7 +508,6 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
NS_RELEASE(hContent);
|
NS_RELEASE(hContent);
|
||||||
if (ATTR_NOTSET == numRows) {
|
if (ATTR_NOTSET == numRows) {
|
||||||
|
@ -579,7 +520,6 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// this handles all of the input types rather than having them do it.
|
|
||||||
nsresult
|
nsresult
|
||||||
nsFormControlHelper::GetFont(nsIFormControlFrame * aFormFrame,
|
nsFormControlHelper::GetFont(nsIFormControlFrame * aFormFrame,
|
||||||
nsIPresContext* aPresContext,
|
nsIPresContext* aPresContext,
|
||||||
|
@ -588,70 +528,8 @@ nsFormControlHelper::GetFont(nsIFormControlFrame * aFormFrame,
|
||||||
{
|
{
|
||||||
const nsStyleFont* styleFont = (const nsStyleFont*)aStyleContext->GetStyleData(eStyleStruct_Font);
|
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;
|
aFont = &styleFont->mFont;
|
||||||
return NS_OK;
|
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;
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -999,31 +877,6 @@ nsFormControlHelper::DoManualSubmitOrReset(nsIPresContext* aPresContext,
|
||||||
return result;
|
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
|
nsresult
|
||||||
nsFormControlHelper::Reset(nsIFrame* aFrame, nsIPresContext* aPresContext)
|
nsFormControlHelper::Reset(nsIFrame* aFrame, nsIPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
|
|
|
@ -133,6 +133,7 @@ public:
|
||||||
PRInt32 aNumChars, nsSize& aSize,
|
PRInt32 aNumChars, nsSize& aSize,
|
||||||
nsIRenderingContext *aRendContext);
|
nsIRenderingContext *aRendContext);
|
||||||
|
|
||||||
|
// XXX This could be removed now that we no longer have form quirks.
|
||||||
static nsresult GetFont(nsIFormControlFrame * aFormFrame,
|
static nsresult GetFont(nsIFormControlFrame * aFormFrame,
|
||||||
nsIPresContext* aPresContext,
|
nsIPresContext* aPresContext,
|
||||||
nsIStyleContext * aStyleContext,
|
nsIStyleContext * aStyleContext,
|
||||||
|
@ -184,7 +185,10 @@ public:
|
||||||
|
|
||||||
static void GetBoolString(const PRBool aValue, nsAString& aResult);
|
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.
|
// wrap can be one of these three values.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -357,15 +361,10 @@ public:
|
||||||
nsIStyleContext* aStyleContext, nsString& aLabel,
|
nsIStyleContext* aStyleContext, nsString& aLabel,
|
||||||
nsIFrame* aForFrame);
|
nsIFrame* aForFrame);
|
||||||
|
|
||||||
static void GetFormCompatibilityMode(nsIPresContext* aPresContext, nsCompatibility& mCompatMode);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsFormControlHelper();
|
nsFormControlHelper();
|
||||||
virtual ~nsFormControlHelper();
|
virtual ~nsFormControlHelper();
|
||||||
|
|
||||||
// Temporary - Test of full time Standard mode for forms (Bug 91602)
|
|
||||||
static PRPackedBool mCompatFirstTime;
|
|
||||||
static PRPackedBool mUseEitherMode;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -578,10 +578,7 @@ nsGfxButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
|
|
||||||
} else { // Normal reflow.
|
} else { // Normal reflow.
|
||||||
|
|
||||||
nsCompatibility mode = eCompatibility_NavQuirks;
|
#if 1
|
||||||
//nsFormControlHelper::GetFormCompatibilityMode(aPresContext, mode);
|
|
||||||
|
|
||||||
if (mode == eCompatibility_NavQuirks) {
|
|
||||||
// nsHTMLButtonControlFrame::Reflow registers it for Standard Mode
|
// nsHTMLButtonControlFrame::Reflow registers it for Standard Mode
|
||||||
// and sets up mPresContext
|
// and sets up mPresContext
|
||||||
if (eReflowReason_Initial == aReflowState.reason) {
|
if (eReflowReason_Initial == aReflowState.reason) {
|
||||||
|
@ -604,11 +601,10 @@ nsGfxButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
if (aDesiredSize.height < aReflowState.mComputedMinHeight) {
|
if (aDesiredSize.height < aReflowState.mComputedMinHeight) {
|
||||||
aDesiredSize.height = aReflowState.mComputedMinHeight;
|
aDesiredSize.height = aReflowState.mComputedMinHeight;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
} else {
|
|
||||||
// Do Standard mode sizing and layout
|
// Do Standard mode sizing and layout
|
||||||
rv = nsHTMLButtonControlFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
rv = nsHTMLButtonControlFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_rodsXXXX
|
#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) */
|
/* Quirk: HRs avoid floats (b=18754) */
|
||||||
|
|
||||||
hr {
|
hr {
|
||||||
|
|
|
@ -90,11 +90,6 @@ static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||||
// it a synonym for "soft"
|
// it a synonym for "soft"
|
||||||
#define kTextControl_Wrap_Off "OFF"
|
#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)
|
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,
|
nsresult nsFormControlHelper::GetFrameFontFM(nsIPresContext* aPresContext,
|
||||||
nsIFormControlFrame * aFrame,
|
nsIFormControlFrame * aFrame,
|
||||||
nsIFontMetrics** aFontMet)
|
nsIFontMetrics** aFontMet)
|
||||||
|
@ -259,7 +238,7 @@ nsFormControlHelper::CalcNavQuirkSizing(nsIPresContext* aPresContext,
|
||||||
maxCharWidth = NSToCoordRound(maxCharWidth * t2p);
|
maxCharWidth = NSToCoordRound(maxCharWidth * t2p);
|
||||||
|
|
||||||
char char1, char2;
|
char char1, char2;
|
||||||
GetRepChars(aPresContext, char1, char2);
|
GetRepChars(char1, char2);
|
||||||
|
|
||||||
nscoord char1Width, char2Width;
|
nscoord char1Width, char2Width;
|
||||||
aRendContext->GetWidth(char1, char1Width);
|
aRendContext->GetWidth(char1, char1Width);
|
||||||
|
@ -379,16 +358,12 @@ nsFormControlHelper::GetTextSize(nsIPresContext* aPresContext, nsIFormControlFra
|
||||||
}
|
}
|
||||||
|
|
||||||
char char1, char2;
|
char char1, char2;
|
||||||
nsCompatibility mode = GetRepChars(aPresContext, char1, char2);
|
GetRepChars(char1, char2);
|
||||||
nscoord char1Width, char2Width;
|
nscoord char1Width, char2Width;
|
||||||
aRendContext->GetWidth(char1, char1Width);
|
aRendContext->GetWidth(char1, char1Width);
|
||||||
aRendContext->GetWidth(char2, char2Width);
|
aRendContext->GetWidth(char2, char2Width);
|
||||||
|
|
||||||
if (eCompatibility_Standard == mode) {
|
|
||||||
return ((char1Width + char2Width) / 2) + 1;
|
return ((char1Width + char2Width) / 2) + 1;
|
||||||
} else {
|
|
||||||
return (char1Width + char2Width) / 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord
|
nscoord
|
||||||
|
@ -398,7 +373,7 @@ nsFormControlHelper::GetTextSize(nsIPresContext* aPresContext, nsIFormControlFra
|
||||||
{
|
{
|
||||||
nsAutoString val;
|
nsAutoString val;
|
||||||
char char1, char2;
|
char char1, char2;
|
||||||
GetRepChars(aPresContext, char1, char2);
|
GetRepChars(char1, char2);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < aNumChars; i+=2) {
|
for (i = 0; i < aNumChars; i+=2) {
|
||||||
val.Append(PRUnichar(char1));
|
val.Append(PRUnichar(char1));
|
||||||
|
@ -472,9 +447,6 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsCompatibility qMode;
|
|
||||||
nsFormControlHelper::GetFormCompatibilityMode(aPresContext, qMode);
|
|
||||||
|
|
||||||
// determine the width, char height, row height
|
// determine the width, char height, row height
|
||||||
if (NS_CONTENT_ATTR_HAS_VALUE == colStatus) { // col attr will provide width
|
if (NS_CONTENT_ATTR_HAS_VALUE == colStatus) { // col attr will provide width
|
||||||
PRInt32 col = ((colAttr.GetUnit() == eHTMLUnit_Pixel) ? colAttr.GetPixelValue() : colAttr.GetIntValue());
|
PRInt32 col = ((colAttr.GetUnit() == eHTMLUnit_Pixel) ? colAttr.GetPixelValue() : colAttr.GetIntValue());
|
||||||
|
@ -486,24 +458,10 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
|
||||||
aDesiredSize.width = NSIntPixelsToTwips(col, p2t);
|
aDesiredSize.width = NSIntPixelsToTwips(col, p2t);
|
||||||
} else {
|
} else {
|
||||||
col = (col <= 0) ? 1 : col; // XXX why a default of 1 char, why hide it
|
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) {
|
if (aSpec.mColSizeAttrInPixels) {
|
||||||
aWidthExplicit = PR_TRUE;
|
aWidthExplicit = PR_TRUE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
aMinSize.width = aDesiredSize.width;
|
aMinSize.width = aDesiredSize.width;
|
||||||
} else {
|
} else {
|
||||||
// set aDesiredSize for height calculation below. CSS may override width
|
// set aDesiredSize for height calculation below. CSS may override width
|
||||||
|
@ -515,23 +473,8 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
|
||||||
charWidth = GetTextSize(aPresContext, aFrame, 1, aDesiredSize, aRendContext);
|
charWidth = GetTextSize(aPresContext, aFrame, 1, aDesiredSize, aRendContext);
|
||||||
aDesiredSize.width = aSpec.mColDefaultSize;
|
aDesiredSize.width = aSpec.mColDefaultSize;
|
||||||
} else { // use default width in num characters
|
} 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;
|
aMinSize.width = aDesiredSize.width;
|
||||||
if (CSS_NOTSET != aCSSSize.width) { // css provides width
|
if (CSS_NOTSET != aCSSSize.width) { // css provides width
|
||||||
NS_ASSERTION(aCSSSize.width >= 0, "form control's computed width is < 0");
|
NS_ASSERTION(aCSSSize.width >= 0, "form control's computed width is < 0");
|
||||||
|
@ -545,7 +488,6 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
|
||||||
aMinSize.height = aDesiredSize.height;
|
aMinSize.height = aDesiredSize.height;
|
||||||
|
|
||||||
// determine the height
|
// determine the height
|
||||||
if (eCompatibility_Standard == qMode) {
|
|
||||||
nsHTMLValue rowAttr;
|
nsHTMLValue rowAttr;
|
||||||
nsresult rowStatus = NS_CONTENT_ATTR_NOT_THERE;
|
nsresult rowStatus = NS_CONTENT_ATTR_NOT_THERE;
|
||||||
if (nsnull != aSpec.mRowSizeAttr) {
|
if (nsnull != aSpec.mRowSizeAttr) {
|
||||||
|
@ -566,7 +508,6 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
NS_RELEASE(hContent);
|
NS_RELEASE(hContent);
|
||||||
if (ATTR_NOTSET == numRows) {
|
if (ATTR_NOTSET == numRows) {
|
||||||
|
@ -579,7 +520,6 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// this handles all of the input types rather than having them do it.
|
|
||||||
nsresult
|
nsresult
|
||||||
nsFormControlHelper::GetFont(nsIFormControlFrame * aFormFrame,
|
nsFormControlHelper::GetFont(nsIFormControlFrame * aFormFrame,
|
||||||
nsIPresContext* aPresContext,
|
nsIPresContext* aPresContext,
|
||||||
|
@ -588,70 +528,8 @@ nsFormControlHelper::GetFont(nsIFormControlFrame * aFormFrame,
|
||||||
{
|
{
|
||||||
const nsStyleFont* styleFont = (const nsStyleFont*)aStyleContext->GetStyleData(eStyleStruct_Font);
|
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;
|
aFont = &styleFont->mFont;
|
||||||
return NS_OK;
|
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;
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -999,31 +877,6 @@ nsFormControlHelper::DoManualSubmitOrReset(nsIPresContext* aPresContext,
|
||||||
return result;
|
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
|
nsresult
|
||||||
nsFormControlHelper::Reset(nsIFrame* aFrame, nsIPresContext* aPresContext)
|
nsFormControlHelper::Reset(nsIFrame* aFrame, nsIPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
|
|
|
@ -133,6 +133,7 @@ public:
|
||||||
PRInt32 aNumChars, nsSize& aSize,
|
PRInt32 aNumChars, nsSize& aSize,
|
||||||
nsIRenderingContext *aRendContext);
|
nsIRenderingContext *aRendContext);
|
||||||
|
|
||||||
|
// XXX This could be removed now that we no longer have form quirks.
|
||||||
static nsresult GetFont(nsIFormControlFrame * aFormFrame,
|
static nsresult GetFont(nsIFormControlFrame * aFormFrame,
|
||||||
nsIPresContext* aPresContext,
|
nsIPresContext* aPresContext,
|
||||||
nsIStyleContext * aStyleContext,
|
nsIStyleContext * aStyleContext,
|
||||||
|
@ -184,7 +185,10 @@ public:
|
||||||
|
|
||||||
static void GetBoolString(const PRBool aValue, nsAString& aResult);
|
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.
|
// wrap can be one of these three values.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -357,15 +361,10 @@ public:
|
||||||
nsIStyleContext* aStyleContext, nsString& aLabel,
|
nsIStyleContext* aStyleContext, nsString& aLabel,
|
||||||
nsIFrame* aForFrame);
|
nsIFrame* aForFrame);
|
||||||
|
|
||||||
static void GetFormCompatibilityMode(nsIPresContext* aPresContext, nsCompatibility& mCompatMode);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsFormControlHelper();
|
nsFormControlHelper();
|
||||||
virtual ~nsFormControlHelper();
|
virtual ~nsFormControlHelper();
|
||||||
|
|
||||||
// Temporary - Test of full time Standard mode for forms (Bug 91602)
|
|
||||||
static PRPackedBool mCompatFirstTime;
|
|
||||||
static PRPackedBool mUseEitherMode;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -578,10 +578,7 @@ nsGfxButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
|
|
||||||
} else { // Normal reflow.
|
} else { // Normal reflow.
|
||||||
|
|
||||||
nsCompatibility mode = eCompatibility_NavQuirks;
|
#if 1
|
||||||
//nsFormControlHelper::GetFormCompatibilityMode(aPresContext, mode);
|
|
||||||
|
|
||||||
if (mode == eCompatibility_NavQuirks) {
|
|
||||||
// nsHTMLButtonControlFrame::Reflow registers it for Standard Mode
|
// nsHTMLButtonControlFrame::Reflow registers it for Standard Mode
|
||||||
// and sets up mPresContext
|
// and sets up mPresContext
|
||||||
if (eReflowReason_Initial == aReflowState.reason) {
|
if (eReflowReason_Initial == aReflowState.reason) {
|
||||||
|
@ -604,11 +601,10 @@ nsGfxButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
if (aDesiredSize.height < aReflowState.mComputedMinHeight) {
|
if (aDesiredSize.height < aReflowState.mComputedMinHeight) {
|
||||||
aDesiredSize.height = aReflowState.mComputedMinHeight;
|
aDesiredSize.height = aReflowState.mComputedMinHeight;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
} else {
|
|
||||||
// Do Standard mode sizing and layout
|
// Do Standard mode sizing and layout
|
||||||
rv = nsHTMLButtonControlFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
rv = nsHTMLButtonControlFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_rodsXXXX
|
#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
|
NS_IMETHODIMP
|
||||||
nsGfxTextControlFrame2::CreateFrameFor(nsIPresContext* aPresContext,
|
nsGfxTextControlFrame2::CreateFrameFor(nsIPresContext* aPresContext,
|
||||||
nsIContent * aContent,
|
nsIContent * aContent,
|
||||||
|
@ -2399,10 +2285,6 @@ nsGfxTextControlFrame2::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||||
if (mState & NS_FRAME_FIRST_REFLOW)
|
if (mState & NS_FRAME_FIRST_REFLOW)
|
||||||
mNotifyOnInput = PR_TRUE;//its ok to notify now. all has been prepared.
|
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;
|
nsReflowStatus aStatus;
|
||||||
nsMargin border;
|
nsMargin border;
|
||||||
border.SizeTo(0, 0, 0, 0);
|
border.SizeTo(0, 0, 0, 0);
|
||||||
|
@ -2418,11 +2300,7 @@ nsGfxTextControlFrame2::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||||
paddingStyle->CalcPaddingFor(this, padding);
|
paddingStyle->CalcPaddingFor(this, padding);
|
||||||
|
|
||||||
nsresult rv;
|
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);
|
AddInset(aSize);
|
||||||
|
|
||||||
mPrefSize = aSize;
|
mPrefSize = aSize;
|
||||||
|
|
|
@ -225,25 +225,6 @@ protected:
|
||||||
nsMargin& aPadding,
|
nsMargin& aPadding,
|
||||||
PRBool aIsUsingDefSize);
|
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,
|
NS_IMETHOD CreateFrameFor(nsIPresContext* aPresContext,
|
||||||
nsIContent * aContent,
|
nsIContent * aContent,
|
||||||
nsIFrame** aFrame);
|
nsIFrame** aFrame);
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
|
#include "nsIServiceManager.h"
|
||||||
#include "nsRuleNode.h"
|
#include "nsRuleNode.h"
|
||||||
#include "nsIDeviceContext.h"
|
#include "nsIDeviceContext.h"
|
||||||
#include "nsILookAndFeel.h"
|
#include "nsILookAndFeel.h"
|
||||||
|
@ -52,10 +53,6 @@
|
||||||
#include "nsITheme.h"
|
#include "nsITheme.h"
|
||||||
#include "pldhash.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.
|
* 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;
|
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;
|
nsCOMPtr<nsIDeviceContext> dc;
|
||||||
aPresContext->GetDeviceContext(getter_AddRefs(dc));
|
aPresContext->GetDeviceContext(getter_AddRefs(dc));
|
||||||
if (dc) {
|
if (dc) {
|
||||||
|
@ -1891,33 +1872,13 @@ SetFont(nsIPresContext* aPresContext, nsIStyleContext* aContext,
|
||||||
aFont->mSize = aFont->mFont.size; // this becomes our cascading size
|
aFont->mSize = aFont->mFont.size; // this becomes our cascading size
|
||||||
}
|
}
|
||||||
|
|
||||||
// NavQuirks uses sans-serif instead of whatever the native font is
|
// XXXldb All of this platform-specific stuff should be in the
|
||||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
// nsIDeviceContext implementations, not here.
|
||||||
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
|
|
||||||
|
|
||||||
#if defined(XP_OS2)
|
#if defined(XP_OS2)
|
||||||
switch (sysID) {
|
switch (sysID) {
|
||||||
case eSystemFont_List:
|
case eSystemFont_List:
|
||||||
case eSystemFont_Button:
|
case eSystemFont_Button:
|
||||||
aFont->mFont.name = defaultVariableFont->name;
|
|
||||||
break;
|
|
||||||
case eSystemFont_Field:
|
case eSystemFont_Field:
|
||||||
if (eCompatibility_NavQuirks == mode)
|
|
||||||
aFont->mFont.name.Assign(NS_LITERAL_STRING("monospace"));
|
|
||||||
else
|
|
||||||
aFont->mFont.name = defaultVariableFont->name;
|
aFont->mFont.name = defaultVariableFont->name;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1932,65 +1893,19 @@ SetFont(nsIPresContext* aPresContext, nsIStyleContext* aContext,
|
||||||
//
|
//
|
||||||
switch (sysID) {
|
switch (sysID) {
|
||||||
// Fields (text fields)
|
// 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:
|
|
||||||
// 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)
|
// 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
|
// We use whatever font is defined by the system. Which it appears
|
||||||
// (and the assumption is) it is always a proportional font. Then we
|
// (and the assumption is) it is always a proportional font. Then we
|
||||||
// always use 2 points smaller than what the browser has defined as
|
// always use 2 points smaller than what the browser has defined as
|
||||||
// the default proportional font.
|
// the default proportional font.
|
||||||
|
case eSystemFont_Field:
|
||||||
case eSystemFont_Button:
|
case eSystemFont_Button:
|
||||||
case eSystemFont_List:
|
case eSystemFont_List:
|
||||||
if (eCompatibility_NavQuirks == mode) {
|
|
||||||
aFont->mFont.name.Assign(NS_LITERAL_STRING("sans-serif"));
|
|
||||||
}
|
|
||||||
// Assumption: system defined font is proportional
|
// Assumption: system defined font is proportional
|
||||||
aFont->mSize = PR_MAX(defaultVariableFont->size - NSIntPointsToTwips(2), 0);
|
aFont->mSize = PR_MAX(defaultVariableFont->size - NSIntPointsToTwips(2), 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#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()) {
|
else if (eCSSUnit_Inherit == aFontData.mFamily.GetUnit()) {
|
||||||
aInherited = PR_TRUE;
|
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) */
|
/* Quirk: HRs avoid floats (b=18754) */
|
||||||
|
|
||||||
hr {
|
hr {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче