Remove some code left over from old native form controls. b=205575 r+sr=roc a=asa

This commit is contained in:
dbaron%dbaron.org 2003-05-14 22:36:33 +00:00
Родитель 193d888612
Коммит 0bc39dd4ff
11 изменённых файлов: 12 добавлений и 328 удалений

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

@ -1692,7 +1692,7 @@ nsCSSFrameConstructor::CreateInputFrame(nsIPresShell *aPresShell,
case NS_FORM_INPUT_BUTTON:
if (UseXBLForms())
return NS_OK;
return ConstructButtonControlFrame(aPresShell, aPresContext, aFrame);
return NS_NewGfxButtonControlFrame(aPresShell, &aFrame);
case NS_FORM_INPUT_CHECKBOX:
if (UseXBLForms())
@ -1715,8 +1715,7 @@ nsCSSFrameConstructor::CreateInputFrame(nsIPresShell *aPresShell,
case NS_FORM_INPUT_TEXT:
case NS_FORM_INPUT_PASSWORD:
return ConstructTextControlFrame(aPresShell, aPresContext,
aFrame, aContent);
return NS_NewTextControlFrame(aPresShell, &aFrame);
default:
NS_ASSERTION(0, "Unknown input type!");
@ -4062,54 +4061,6 @@ nsCSSFrameConstructor::CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
return rv;
}
nsWidgetRendering
nsCSSFrameConstructor::GetFormElementRenderingMode(nsIPresContext* aPresContext,
nsWidgetType aWidgetType)
{
if (!aPresContext) { return eWidgetRendering_Gfx;}
nsWidgetRendering mode;
aPresContext->GetWidgetRenderingMode(&mode);
switch (mode)
{
case eWidgetRendering_Gfx:
return eWidgetRendering_Gfx;
case eWidgetRendering_PartialGfx:
switch (aWidgetType)
{
case eWidgetType_Button:
case eWidgetType_Checkbox:
case eWidgetType_Radio:
case eWidgetType_Text:
return eWidgetRendering_Gfx;
default:
return eWidgetRendering_Native;
}
case eWidgetRendering_Native:
PRBool useNativeWidgets = PR_FALSE;
nsIDeviceContext* dc;
aPresContext->GetDeviceContext(&dc);
if (dc) {
PRBool supportsWidgets;
if (NS_SUCCEEDED(dc->SupportsNativeWidgets(supportsWidgets))) {
useNativeWidgets = supportsWidgets;
}
NS_RELEASE(dc);
}
if (useNativeWidgets)
return eWidgetRendering_Native;
else
return eWidgetRendering_Gfx;
}
return eWidgetRendering_Gfx;
}
nsresult
nsCSSFrameConstructor::ConstructRadioControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
@ -4117,12 +4068,7 @@ nsCSSFrameConstructor::ConstructRadioControlFrame(nsIPresShell* aPresShel
nsIContent* aContent,
nsStyleContext* aStyleContext)
{
nsresult rv = NS_OK;
if (GetFormElementRenderingMode(aPresContext, eWidgetType_Radio) == eWidgetRendering_Gfx)
rv = NS_NewGfxRadioControlFrame(aPresShell, &aNewFrame);
else
NS_ASSERTION(0, "We longer support native widgets");
nsresult rv = NS_NewGfxRadioControlFrame(aPresShell, &aNewFrame);
if (NS_FAILED(rv)) {
aNewFrame = nsnull;
return rv;
@ -4147,15 +4093,10 @@ nsCSSFrameConstructor::ConstructCheckboxControlFrame(nsIPresShell* aPresShell
nsIContent* aContent,
nsStyleContext* aStyleContext)
{
nsresult rv = NS_OK;
if (GetFormElementRenderingMode(aPresContext, eWidgetType_Checkbox) == eWidgetRendering_Gfx)
rv = NS_NewGfxCheckboxControlFrame(aPresShell, &aNewFrame);
else
NS_ASSERTION(0, "We longer support native widgets");
nsresult rv = NS_NewGfxCheckboxControlFrame(aPresShell, &aNewFrame);
if (NS_FAILED(rv)) {
aNewFrame = nsnull;
return rv;
}
nsRefPtr<nsStyleContext> checkboxStyle;
@ -4171,49 +4112,6 @@ nsCSSFrameConstructor::ConstructCheckboxControlFrame(nsIPresShell* aPresShell
return rv;
}
nsresult
nsCSSFrameConstructor::ConstructButtonControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame)
{
nsresult rv = NS_OK;
if (GetFormElementRenderingMode(aPresContext, eWidgetType_Button)
== eWidgetRendering_Gfx)
rv = NS_NewGfxButtonControlFrame(aPresShell, &aNewFrame);
else
NS_ASSERTION(0, "We longer support native widgets");
if (NS_FAILED(rv)) {
aNewFrame = nsnull;
}
return rv;
}
nsresult
nsCSSFrameConstructor::ConstructTextControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame,
nsIContent* aContent)
{
if (!aPresContext) { return NS_ERROR_NULL_POINTER;}
nsresult rv = NS_OK;
nsWidgetRendering mode;
aPresContext->GetWidgetRenderingMode(&mode);
if (eWidgetRendering_Gfx == mode)
{
rv = NS_NewTextControlFrame(aPresShell, &aNewFrame);
if (NS_FAILED(rv)) {
aNewFrame = nsnull;
}
}
if (!aNewFrame)
{
NS_ASSERTION(0, "We longer support native widgets");
}
return rv;
}
PRBool
nsCSSFrameConstructor::UseXBLForms()
{
@ -4800,7 +4698,7 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsIPresShell* aPresShell,
ProcessPseudoFrames(aPresContext, aState.mPseudoFrames, aFrameItems);
}
isReplaced = PR_TRUE;
rv = ConstructTextControlFrame(aPresShell, aPresContext, newFrame, aContent);
rv = NS_NewTextControlFrame(aPresShell, &newFrame);
}
else if (nsHTMLAtoms::select == aTag) {
if (!UseXBLForms()) {

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

@ -477,9 +477,6 @@ protected:
nsIFrame* aContentParent,
nsIFrame*& aFrame);
nsWidgetRendering GetFormElementRenderingMode(nsIPresContext* aPresContext,
nsWidgetType aWidgetType);
nsresult ConstructRadioControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame,
@ -492,16 +489,6 @@ protected:
nsIContent* aContent,
nsStyleContext* aStyleContext);
nsresult ConstructButtonControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame);
nsresult ConstructTextControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame,
nsIContent* aContent);
nsresult ConstructSelectFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,

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

@ -155,7 +155,6 @@ nsPresContext::nsPresContext()
mNoTheme(PR_FALSE)
{
mCompatibilityMode = eCompatibility_FullStandards;
mWidgetRenderingMode = eWidgetRendering_Gfx;
mImageAnimationMode = imgIContainer::kNormalAnimMode;
mImageAnimationModePref = imgIContainer::kNormalAnimMode;
@ -451,10 +450,6 @@ nsPresContext::GetUserPreferences()
mFontScaler = prefInt;
}
if (NS_SUCCEEDED(mPrefs->GetIntPref("nglayout.widget.mode", &prefInt))) {
mWidgetRenderingMode = (enum nsWidgetRendering)prefInt; // bad cast
}
// * document colors
GetDocumentColorPreferences();
@ -783,23 +778,6 @@ nsPresContext::SetCompatibilityMode(nsCompatibility aMode)
return NS_OK;
}
NS_IMETHODIMP
nsPresContext::GetWidgetRenderingMode(nsWidgetRendering* aResult)
{
NS_PRECONDITION(aResult, "null out param");
*aResult = mWidgetRenderingMode;
return NS_OK;
}
NS_IMETHODIMP
nsPresContext::SetWidgetRenderingMode(nsWidgetRendering aMode)
{
mWidgetRenderingMode = aMode;
return NS_OK;
}
NS_IMETHODIMP
nsPresContext::GetImageAnimationMode(PRUint16* aModeResult)
{

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

@ -83,12 +83,6 @@ class nsIRenderingContext;
{ 0x0a5d12e0, 0x944e, 0x11d1, \
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
enum nsWidgetRendering {
eWidgetRendering_Native = 1,
eWidgetRendering_Gfx = 2,
eWidgetRendering_PartialGfx = 3
};
enum nsWidgetType {
eWidgetType_Button = 1,
eWidgetType_Checkbox = 2,
@ -147,12 +141,6 @@ public:
NS_IMETHOD GetCompatibilityMode(nsCompatibility* aModeResult) = 0;
NS_IMETHOD SetCompatibilityMode(nsCompatibility aMode) = 0;
/**
* Access the widget rendering mode for this context
*/
NS_IMETHOD GetWidgetRenderingMode(nsWidgetRendering* aModeResult) = 0;
NS_IMETHOD SetWidgetRenderingMode(nsWidgetRendering aMode) = 0;
/**
* Access the image animation mode for this context
*/

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

@ -83,12 +83,6 @@ class nsIRenderingContext;
{ 0x0a5d12e0, 0x944e, 0x11d1, \
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
enum nsWidgetRendering {
eWidgetRendering_Native = 1,
eWidgetRendering_Gfx = 2,
eWidgetRendering_PartialGfx = 3
};
enum nsWidgetType {
eWidgetType_Button = 1,
eWidgetType_Checkbox = 2,
@ -147,12 +141,6 @@ public:
NS_IMETHOD GetCompatibilityMode(nsCompatibility* aModeResult) = 0;
NS_IMETHOD SetCompatibilityMode(nsCompatibility aMode) = 0;
/**
* Access the widget rendering mode for this context
*/
NS_IMETHOD GetWidgetRenderingMode(nsWidgetRendering* aModeResult) = 0;
NS_IMETHOD SetWidgetRenderingMode(nsWidgetRendering aMode) = 0;
/**
* Access the image animation mode for this context
*/

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

@ -83,12 +83,6 @@ class nsIRenderingContext;
{ 0x0a5d12e0, 0x944e, 0x11d1, \
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
enum nsWidgetRendering {
eWidgetRendering_Native = 1,
eWidgetRendering_Gfx = 2,
eWidgetRendering_PartialGfx = 3
};
enum nsWidgetType {
eWidgetType_Button = 1,
eWidgetType_Checkbox = 2,
@ -147,12 +141,6 @@ public:
NS_IMETHOD GetCompatibilityMode(nsCompatibility* aModeResult) = 0;
NS_IMETHOD SetCompatibilityMode(nsCompatibility aMode) = 0;
/**
* Access the widget rendering mode for this context
*/
NS_IMETHOD GetWidgetRenderingMode(nsWidgetRendering* aModeResult) = 0;
NS_IMETHOD SetWidgetRenderingMode(nsWidgetRendering aMode) = 0;
/**
* Access the image animation mode for this context
*/

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

@ -155,7 +155,6 @@ nsPresContext::nsPresContext()
mNoTheme(PR_FALSE)
{
mCompatibilityMode = eCompatibility_FullStandards;
mWidgetRenderingMode = eWidgetRendering_Gfx;
mImageAnimationMode = imgIContainer::kNormalAnimMode;
mImageAnimationModePref = imgIContainer::kNormalAnimMode;
@ -451,10 +450,6 @@ nsPresContext::GetUserPreferences()
mFontScaler = prefInt;
}
if (NS_SUCCEEDED(mPrefs->GetIntPref("nglayout.widget.mode", &prefInt))) {
mWidgetRenderingMode = (enum nsWidgetRendering)prefInt; // bad cast
}
// * document colors
GetDocumentColorPreferences();
@ -783,23 +778,6 @@ nsPresContext::SetCompatibilityMode(nsCompatibility aMode)
return NS_OK;
}
NS_IMETHODIMP
nsPresContext::GetWidgetRenderingMode(nsWidgetRendering* aResult)
{
NS_PRECONDITION(aResult, "null out param");
*aResult = mWidgetRenderingMode;
return NS_OK;
}
NS_IMETHODIMP
nsPresContext::SetWidgetRenderingMode(nsWidgetRendering aMode)
{
mWidgetRenderingMode = aMode;
return NS_OK;
}
NS_IMETHODIMP
nsPresContext::GetImageAnimationMode(PRUint16* aModeResult)
{

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

@ -74,8 +74,6 @@ public:
NS_IMETHOD GetShell(nsIPresShell** aResult);
NS_IMETHOD GetCompatibilityMode(nsCompatibility* aModeResult);
NS_IMETHOD SetCompatibilityMode(nsCompatibility aMode);
NS_IMETHOD GetWidgetRenderingMode(nsWidgetRendering* aModeResult);
NS_IMETHOD SetWidgetRenderingMode(nsWidgetRendering aMode);
NS_IMETHOD GetImageAnimationMode(PRUint16* aModeResult);
NS_IMETHOD SetImageAnimationMode(PRUint16 aMode);
NS_IMETHOD GetImageLoadFlags(nsLoadFlags& aLoadFlags);
@ -263,7 +261,6 @@ protected:
nsCOMPtr<nsIURI> mBaseURL;
nsCompatibility mCompatibilityMode;
nsWidgetRendering mWidgetRenderingMode;
PRPackedBool mImageAnimationStopped; // image animation stopped
PRUint16 mImageAnimationMode;

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

@ -1692,7 +1692,7 @@ nsCSSFrameConstructor::CreateInputFrame(nsIPresShell *aPresShell,
case NS_FORM_INPUT_BUTTON:
if (UseXBLForms())
return NS_OK;
return ConstructButtonControlFrame(aPresShell, aPresContext, aFrame);
return NS_NewGfxButtonControlFrame(aPresShell, &aFrame);
case NS_FORM_INPUT_CHECKBOX:
if (UseXBLForms())
@ -1715,8 +1715,7 @@ nsCSSFrameConstructor::CreateInputFrame(nsIPresShell *aPresShell,
case NS_FORM_INPUT_TEXT:
case NS_FORM_INPUT_PASSWORD:
return ConstructTextControlFrame(aPresShell, aPresContext,
aFrame, aContent);
return NS_NewTextControlFrame(aPresShell, &aFrame);
default:
NS_ASSERTION(0, "Unknown input type!");
@ -4062,54 +4061,6 @@ nsCSSFrameConstructor::CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
return rv;
}
nsWidgetRendering
nsCSSFrameConstructor::GetFormElementRenderingMode(nsIPresContext* aPresContext,
nsWidgetType aWidgetType)
{
if (!aPresContext) { return eWidgetRendering_Gfx;}
nsWidgetRendering mode;
aPresContext->GetWidgetRenderingMode(&mode);
switch (mode)
{
case eWidgetRendering_Gfx:
return eWidgetRendering_Gfx;
case eWidgetRendering_PartialGfx:
switch (aWidgetType)
{
case eWidgetType_Button:
case eWidgetType_Checkbox:
case eWidgetType_Radio:
case eWidgetType_Text:
return eWidgetRendering_Gfx;
default:
return eWidgetRendering_Native;
}
case eWidgetRendering_Native:
PRBool useNativeWidgets = PR_FALSE;
nsIDeviceContext* dc;
aPresContext->GetDeviceContext(&dc);
if (dc) {
PRBool supportsWidgets;
if (NS_SUCCEEDED(dc->SupportsNativeWidgets(supportsWidgets))) {
useNativeWidgets = supportsWidgets;
}
NS_RELEASE(dc);
}
if (useNativeWidgets)
return eWidgetRendering_Native;
else
return eWidgetRendering_Gfx;
}
return eWidgetRendering_Gfx;
}
nsresult
nsCSSFrameConstructor::ConstructRadioControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
@ -4117,12 +4068,7 @@ nsCSSFrameConstructor::ConstructRadioControlFrame(nsIPresShell* aPresShel
nsIContent* aContent,
nsStyleContext* aStyleContext)
{
nsresult rv = NS_OK;
if (GetFormElementRenderingMode(aPresContext, eWidgetType_Radio) == eWidgetRendering_Gfx)
rv = NS_NewGfxRadioControlFrame(aPresShell, &aNewFrame);
else
NS_ASSERTION(0, "We longer support native widgets");
nsresult rv = NS_NewGfxRadioControlFrame(aPresShell, &aNewFrame);
if (NS_FAILED(rv)) {
aNewFrame = nsnull;
return rv;
@ -4147,15 +4093,10 @@ nsCSSFrameConstructor::ConstructCheckboxControlFrame(nsIPresShell* aPresShell
nsIContent* aContent,
nsStyleContext* aStyleContext)
{
nsresult rv = NS_OK;
if (GetFormElementRenderingMode(aPresContext, eWidgetType_Checkbox) == eWidgetRendering_Gfx)
rv = NS_NewGfxCheckboxControlFrame(aPresShell, &aNewFrame);
else
NS_ASSERTION(0, "We longer support native widgets");
nsresult rv = NS_NewGfxCheckboxControlFrame(aPresShell, &aNewFrame);
if (NS_FAILED(rv)) {
aNewFrame = nsnull;
return rv;
}
nsRefPtr<nsStyleContext> checkboxStyle;
@ -4171,49 +4112,6 @@ nsCSSFrameConstructor::ConstructCheckboxControlFrame(nsIPresShell* aPresShell
return rv;
}
nsresult
nsCSSFrameConstructor::ConstructButtonControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame)
{
nsresult rv = NS_OK;
if (GetFormElementRenderingMode(aPresContext, eWidgetType_Button)
== eWidgetRendering_Gfx)
rv = NS_NewGfxButtonControlFrame(aPresShell, &aNewFrame);
else
NS_ASSERTION(0, "We longer support native widgets");
if (NS_FAILED(rv)) {
aNewFrame = nsnull;
}
return rv;
}
nsresult
nsCSSFrameConstructor::ConstructTextControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame,
nsIContent* aContent)
{
if (!aPresContext) { return NS_ERROR_NULL_POINTER;}
nsresult rv = NS_OK;
nsWidgetRendering mode;
aPresContext->GetWidgetRenderingMode(&mode);
if (eWidgetRendering_Gfx == mode)
{
rv = NS_NewTextControlFrame(aPresShell, &aNewFrame);
if (NS_FAILED(rv)) {
aNewFrame = nsnull;
}
}
if (!aNewFrame)
{
NS_ASSERTION(0, "We longer support native widgets");
}
return rv;
}
PRBool
nsCSSFrameConstructor::UseXBLForms()
{
@ -4800,7 +4698,7 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsIPresShell* aPresShell,
ProcessPseudoFrames(aPresContext, aState.mPseudoFrames, aFrameItems);
}
isReplaced = PR_TRUE;
rv = ConstructTextControlFrame(aPresShell, aPresContext, newFrame, aContent);
rv = NS_NewTextControlFrame(aPresShell, &newFrame);
}
else if (nsHTMLAtoms::select == aTag) {
if (!UseXBLForms()) {

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

@ -477,9 +477,6 @@ protected:
nsIFrame* aContentParent,
nsIFrame*& aFrame);
nsWidgetRendering GetFormElementRenderingMode(nsIPresContext* aPresContext,
nsWidgetType aWidgetType);
nsresult ConstructRadioControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame,
@ -492,16 +489,6 @@ protected:
nsIContent* aContent,
nsStyleContext* aStyleContext);
nsresult ConstructButtonControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame);
nsresult ConstructTextControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame,
nsIContent* aContent);
nsresult ConstructSelectFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,

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

@ -211,9 +211,6 @@ pref("browser.windows.loadOnNewWindow", 1);
pref("view_source.syntax_highlight", true);
pref("view_source.wrap_long_lines", false);
// gfx widgets
pref("nglayout.widget.mode", 2);
// dispatch left clicks only to content in browser (still allows clicks to chrome/xul)
pref("nglayout.events.dispatchLeftClickOnly", true);