From 04ba615cb80cab6d5067641b434369ebda225a98 Mon Sep 17 00:00:00 2001 From: "pierre%netscape.com" Date: Sun, 20 Dec 1998 13:18:10 +0000 Subject: [PATCH] Fix forms: XP_MAC code was missing in GetHorizontalInsidePadding and GetVerticalInsidePadding --- layout/forms/nsTextControlFrame.cpp | 25 +++++++++++++++++++ .../html/forms/src/nsButtonControlFrame.cpp | 10 ++++++++ .../html/forms/src/nsSelectControlFrame.cpp | 12 +++++++++ layout/html/forms/src/nsTextControlFrame.cpp | 25 +++++++++++++++++++ 4 files changed, 72 insertions(+) diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp index 4fcd5babd30..77f90e58617 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -101,6 +101,15 @@ nsTextControlFrame::GetVerticalInsidePadding(float aPixToTwip, #ifdef XP_UNIX return NSIntPixelsToTwips(10, aPixToTwip); // XXX this is probably wrong #endif +#ifdef XP_MAC + PRInt32 type; + GetType(&type); + if (NS_FORM_TEXTAREA == type) { + return (nscoord)NSToIntRound(float(aInnerHeight) * 0.40f); + } else { + return (nscoord)NSToIntRound(float(aInnerHeight) * 0.25f); + } +#endif } nscoord @@ -128,6 +137,22 @@ nsTextControlFrame::GetHorizontalInsidePadding(nsIPresContext& aPresContext, #ifdef XP_UNIX return NSIntPixelsToTwips(6, aPixToTwip); // XXX this is probably wrong #endif +#ifdef XP_MAC + nscoord padding; + PRInt32 type; + GetType(&type); + if (NS_FORM_TEXTAREA == type) { + padding = (nscoord)(40 * aCharWidth / 100); + } else { + padding = (nscoord)(95 * aCharWidth / 100); + } + nscoord min = NSIntPixelsToTwips(3, aPixToTwip); + if (padding > min) { + return padding; + } else { + return min; + } +#endif } diff --git a/layout/html/forms/src/nsButtonControlFrame.cpp b/layout/html/forms/src/nsButtonControlFrame.cpp index 6b7ddf5fe5a..689cd74227e 100644 --- a/layout/html/forms/src/nsButtonControlFrame.cpp +++ b/layout/html/forms/src/nsButtonControlFrame.cpp @@ -151,6 +151,9 @@ nsButtonControlFrame::GetVerticalInsidePadding(float aPixToTwip, #ifdef XP_UNIX return (nscoord)NSToIntRound((float)aInnerHeight * 0.50f); #endif +#ifdef XP_MAC + return (nscoord)NSToIntRound((float)aInnerHeight * 0.50f); +#endif } nscoord @@ -176,6 +179,13 @@ nsButtonControlFrame::GetHorizontalInsidePadding(nsIPresContext& aPresContext, return NSIntPixelsToTwips(20, aPixToTwip); } #endif +#ifdef XP_MAC + if (eCompatibility_NavQuirks == mode) { + return (nscoord)NSToIntRound(float(aInnerWidth) * 0.5f); + } else { + return NSIntPixelsToTwips(20, aPixToTwip); + } +#endif } diff --git a/layout/html/forms/src/nsSelectControlFrame.cpp b/layout/html/forms/src/nsSelectControlFrame.cpp index 209a474c693..29a9884ecda 100644 --- a/layout/html/forms/src/nsSelectControlFrame.cpp +++ b/layout/html/forms/src/nsSelectControlFrame.cpp @@ -169,6 +169,9 @@ nsSelectControlFrame::GetVerticalInsidePadding(float aPixToTwip, #ifdef XP_UNIX return NSIntPixelsToTwips(1, aPixToTwip); // XXX this is probably wrong #endif +#ifdef XP_MAC + return (nscoord)NSToIntRound(float(aInnerHeight) * 0.10f); +#endif } PRInt32 @@ -189,6 +192,15 @@ nsSelectControlFrame::GetHorizontalInsidePadding(nsIPresContext& aPresContext, #ifdef XP_UNIX return NSIntPixelsToTwips(7, aPixToTwip); // XXX this is probably wrong #endif +#ifdef XP_MAC + nscoord padding = (nscoord)NSToIntRound(float(aCharWidth) * 0.40f); + nscoord min = NSIntPixelsToTwips(3, aPixToTwip); + if (padding > min) { + return padding; + } else { + return min; + } +#endif } const nsIID& diff --git a/layout/html/forms/src/nsTextControlFrame.cpp b/layout/html/forms/src/nsTextControlFrame.cpp index 4fcd5babd30..77f90e58617 100644 --- a/layout/html/forms/src/nsTextControlFrame.cpp +++ b/layout/html/forms/src/nsTextControlFrame.cpp @@ -101,6 +101,15 @@ nsTextControlFrame::GetVerticalInsidePadding(float aPixToTwip, #ifdef XP_UNIX return NSIntPixelsToTwips(10, aPixToTwip); // XXX this is probably wrong #endif +#ifdef XP_MAC + PRInt32 type; + GetType(&type); + if (NS_FORM_TEXTAREA == type) { + return (nscoord)NSToIntRound(float(aInnerHeight) * 0.40f); + } else { + return (nscoord)NSToIntRound(float(aInnerHeight) * 0.25f); + } +#endif } nscoord @@ -128,6 +137,22 @@ nsTextControlFrame::GetHorizontalInsidePadding(nsIPresContext& aPresContext, #ifdef XP_UNIX return NSIntPixelsToTwips(6, aPixToTwip); // XXX this is probably wrong #endif +#ifdef XP_MAC + nscoord padding; + PRInt32 type; + GetType(&type); + if (NS_FORM_TEXTAREA == type) { + padding = (nscoord)(40 * aCharWidth / 100); + } else { + padding = (nscoord)(95 * aCharWidth / 100); + } + nscoord min = NSIntPixelsToTwips(3, aPixToTwip); + if (padding > min) { + return padding; + } else { + return min; + } +#endif }