mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 326883 - Cleanup unused methods. r+sr=roc
This commit is contained in:
parent
9bc3c38993
commit
eb31b955a4
@ -34,82 +34,21 @@
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsFormControlFrame.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsLeafFrame.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsIView.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsViewsCID.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsUnitConversion.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLLabelElement.h"
|
||||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
#include "nsIDOMHTMLLegendElement.h"
|
||||
#include "nsIDOMHTMLButtonElement.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
|
||||
#ifdef DEBUG_evaughan
|
||||
//#define DEBUG_rods
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_rods
|
||||
//#define FCF_NOISY
|
||||
#endif
|
||||
|
||||
#ifdef FCF_NOISY
|
||||
#define REFLOW_DEBUG_MSG(_msg1) printf((_msg1))
|
||||
#define REFLOW_DEBUG_MSG2(_msg1, _msg2) printf((_msg1), (_msg2))
|
||||
#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3) printf((_msg1), (_msg2), (_msg3))
|
||||
#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) printf((_msg1), (_msg2), (_msg3), (_msg4))
|
||||
|
||||
#define IF_REFLOW_DEBUG_MSG(_bool, _msg1) if ((_bool)) printf((_msg1))
|
||||
#define IF_REFLOW_DEBUG_MSG2(_bool, _msg1, _msg2) if ((_bool)) printf((_msg1), (_msg2))
|
||||
#define IF_REFLOW_DEBUG_MSG3(_bool, _msg1, _msg2, _msg3) if ((_bool)) printf((_msg1), (_msg2), (_msg3))
|
||||
#define IF_REFLOW_DEBUG_MSG4(_bool, _msg1, _msg2, _msg3, _msg4) if ((_bool)) printf((_msg1), (_msg2), (_msg3), (_msg4))
|
||||
|
||||
#else //-------------
|
||||
#define REFLOW_DEBUG_MSG(_msg)
|
||||
#define REFLOW_DEBUG_MSG2(_msg1, _msg2)
|
||||
#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3)
|
||||
#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4)
|
||||
|
||||
#define IF_REFLOW_DEBUG_MSG(_bool, _msg)
|
||||
#define IF_REFLOW_DEBUG_MSG2(_bool, _msg1, _msg2)
|
||||
#define IF_REFLOW_DEBUG_MSG3(_bool, _msg1, _msg2, _msg3)
|
||||
#define IF_REFLOW_DEBUG_MSG4(_bool, _msg1, _msg2, _msg3, _msg4)
|
||||
#endif
|
||||
|
||||
const PRInt32 kSizeNotSet = -1;
|
||||
|
||||
nsFormControlFrame::nsFormControlFrame()
|
||||
: nsLeafFrame()
|
||||
{
|
||||
mDidInit = PR_FALSE;
|
||||
|
||||
// Reflow Optimization
|
||||
mCacheSize.width = kSizeNotSet;
|
||||
mCacheSize.height = kSizeNotSet;
|
||||
mCachedMaxElementWidth = kSizeNotSet;
|
||||
}
|
||||
|
||||
nsFormControlFrame::~nsFormControlFrame()
|
||||
@ -153,97 +92,6 @@ void nsFormControlFrame::SetupCachedSizes(nsSize& aCacheSize,
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 // Testing out changes
|
||||
//------------------------------------------------------------
|
||||
void nsFormControlFrame::SkipResizeReflow(nsSize& aCacheSize,
|
||||
nscoord& aCachedMaxElementWidth,
|
||||
nsSize& aCachedAvailableSize,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus,
|
||||
PRBool& aBailOnWidth,
|
||||
PRBool& aBailOnHeight)
|
||||
{
|
||||
|
||||
if (aReflowState.reason == eReflowReason_Incremental ||
|
||||
aReflowState.reason == eReflowReason_Dirty) {
|
||||
aBailOnHeight = PR_FALSE;
|
||||
aBailOnWidth = PR_FALSE;
|
||||
|
||||
} else if (eReflowReason_Initial == aReflowState.reason) {
|
||||
aBailOnHeight = PR_FALSE;
|
||||
aBailOnWidth = PR_FALSE;
|
||||
|
||||
} else {
|
||||
|
||||
nscoord width;
|
||||
if (NS_UNCONSTRAINEDSIZE == aReflowState.mComputedWidth) {
|
||||
if (aReflowState.availableWidth == NS_UNCONSTRAINEDSIZE) {
|
||||
width = NS_UNCONSTRAINEDSIZE;
|
||||
aBailOnWidth = aCacheSize.width != kSizeNotSet;
|
||||
IF_REFLOW_DEBUG_MSG2(aBailOnWidth, "-------------- #1 Bailing on aCachedAvailableSize.width %d != kSizeNotSet\n", aCachedAvailableSize.width);
|
||||
} else {
|
||||
//width = aReflowState.availableWidth - aReflowState.mComputedBorderPadding.left -
|
||||
// aReflowState.mComputedBorderPadding.right;
|
||||
aBailOnWidth = aCacheSize.width <= aReflowState.availableWidth && aCacheSize.width != kSizeNotSet;
|
||||
|
||||
if (aBailOnWidth) {
|
||||
REFLOW_DEBUG_MSG3("-------------- #2 Bailing on aCachedSize.width %d <= (AW - BP) %d\n", aCachedAvailableSize.width, width );
|
||||
} else {
|
||||
//aBailOnWidth = width <= (aCacheSize.width - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right) &&
|
||||
// aCachedAvailableSize.width == kSizeNotSet;
|
||||
//if (aBailOnWidth) {
|
||||
// REFLOW_DEBUG_MSG3("-------------- #2.2 Bailing on width %d <= aCachedSize.width %d\n", width, (aCacheSize.width - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right));
|
||||
//}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
width = aReflowState.mComputedWidth;
|
||||
aBailOnWidth = width == (aCacheSize.width - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right);
|
||||
IF_REFLOW_DEBUG_MSG3(aBailOnWidth, "-------------- #3 Bailing on aCachedAvailableSize.width %d == aReflowState.mComputedWidth %d\n", aCachedAvailableSize.width, width );
|
||||
}
|
||||
|
||||
nscoord height;
|
||||
if (NS_UNCONSTRAINEDSIZE == aReflowState.mComputedHeight) {
|
||||
if (aReflowState.availableHeight == NS_UNCONSTRAINEDSIZE) {
|
||||
height = NS_UNCONSTRAINEDSIZE;
|
||||
aBailOnHeight = aCacheSize.height != kSizeNotSet;
|
||||
if (aBailOnHeight) {
|
||||
IF_REFLOW_DEBUG_MSG2(aBailOnHeight, "-------------- #1 Bailing on aCachedAvailableSize.height %d != kSizeNotSet\n", aCachedAvailableSize.height);
|
||||
}
|
||||
} else {
|
||||
height = aReflowState.availableHeight - aReflowState.mComputedBorderPadding.left -
|
||||
aReflowState.mComputedBorderPadding.right;
|
||||
aBailOnHeight = aCachedAvailableSize.height <= height && aCachedAvailableSize.height != kSizeNotSet;
|
||||
if (aBailOnHeight) {
|
||||
REFLOW_DEBUG_MSG3("-------------- #2 Bailing on aCachedAvailableSize.height %d <= height %d\n", aCachedAvailableSize.height, height );
|
||||
} else {
|
||||
aBailOnHeight = height <= (aCacheSize.height - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right) &&
|
||||
aCachedAvailableSize.height == kSizeNotSet;
|
||||
if (aBailOnHeight) {
|
||||
REFLOW_DEBUG_MSG3("-------------- #2.2 Bailing on height %d <= aCachedSize.height %d\n", height, (aCacheSize.height - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
height = aReflowState.mComputedHeight;
|
||||
aBailOnHeight = height == (aCacheSize.height - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right);
|
||||
IF_REFLOW_DEBUG_MSG3(aBailOnHeight, "-------------- #3 Bailing on aCachedAvailableSize.height %d == aReflowState.mComputedHeight %d\n", aCachedAvailableSize.height, height );
|
||||
}
|
||||
|
||||
if (aBailOnWidth || aBailOnHeight) {
|
||||
aDesiredSize.width = aCacheSize.width;
|
||||
aDesiredSize.height = aCacheSize.height;
|
||||
|
||||
if (aDesiredSize.mComputeMEW) {
|
||||
aDesiredSize.mMaxElementWidth = aCachedMaxElementWidth;
|
||||
}
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
//------------------------------------------------------------
|
||||
void nsFormControlFrame::SkipResizeReflow(nsSize& aCacheSize,
|
||||
nscoord& aCachedAscent,
|
||||
@ -364,54 +212,24 @@ void nsFormControlFrame::SkipResizeReflow(nsSize& aCacheSize,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
nscoord
|
||||
nsFormControlFrame::GetScrollbarWidth(float aPixToTwip)
|
||||
{
|
||||
return NSIntPixelsToTwips(19, aPixToTwip); // XXX this is windows
|
||||
}
|
||||
|
||||
void
|
||||
nsFormControlFrame::SetClickPoint(nscoord aX, nscoord aY)
|
||||
{
|
||||
mLastClickPoint.x = aX;
|
||||
mLastClickPoint.y = aY;
|
||||
}
|
||||
|
||||
// REVIEW: All nsFormControlFrame does different with painting is to put
|
||||
// its standard decorations entirely in the "foreground" layer. But our only
|
||||
// two subclasses are radio buttons and checkboxes, which are normally inline
|
||||
// elements, so this will happen anyway.
|
||||
void
|
||||
nsFormControlFrame::GetDesiredSize(nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredLayoutSize,
|
||||
nsSize& aDesiredWidgetSize)
|
||||
{
|
||||
// get the css size and let the frame use or override it
|
||||
nsSize styleSize;
|
||||
GetStyleSize(aPresContext, aReflowState, styleSize);
|
||||
|
||||
// subclasses should always override this method, but if not and no css, make it small
|
||||
aDesiredLayoutSize.width = (styleSize.width > CSS_NOTSET) ? styleSize.width : 144;
|
||||
aDesiredLayoutSize.height = (styleSize.height > CSS_NOTSET) ? styleSize.height : 144;
|
||||
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
|
||||
aDesiredLayoutSize.descent = 0;
|
||||
if (aDesiredLayoutSize.mComputeMEW) {
|
||||
aDesiredLayoutSize.SetMEWToActualWidth(aReflowState.mStylePosition->mWidth.GetUnit());
|
||||
}
|
||||
aDesiredWidgetSize.width = aDesiredLayoutSize.width;
|
||||
aDesiredWidgetSize.height = aDesiredLayoutSize.height;
|
||||
}
|
||||
|
||||
void
|
||||
nsFormControlFrame::GetDesiredSize(nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize)
|
||||
{
|
||||
nsSize ignore;
|
||||
GetDesiredSize(aPresContext, aReflowState, aDesiredSize, ignore);
|
||||
// get the css size and let the frame use or override it
|
||||
nsSize styleSize;
|
||||
GetStyleSize(aPresContext, aReflowState, styleSize);
|
||||
|
||||
// subclasses should always override this method, but if not and no css, make it small
|
||||
aDesiredSize.width = (styleSize.width > CSS_NOTSET) ? styleSize.width : 144;
|
||||
aDesiredSize.height = (styleSize.height > CSS_NOTSET) ? styleSize.height : 144;
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
if (aDesiredSize.mComputeMEW) {
|
||||
aDesiredSize.SetMEWToActualWidth(aReflowState.mStylePosition->mWidth.GetUnit());
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -465,32 +283,15 @@ nsFormControlFrame::Reflow(nsPresContext* aPresContext,
|
||||
mDidInit = PR_TRUE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
nsresult skiprv = SkipResizeReflow(mCacheSize, mCachedMaxElementWidth, aPresContext,
|
||||
aDesiredSize, aReflowState, aStatus);
|
||||
if (NS_SUCCEEDED(skiprv)) {
|
||||
return skiprv;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult rv = nsLeafFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
SetupCachedSizes(mCacheSize, mCachedAscent, mCachedMaxElementWidth, aDesiredSize);
|
||||
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
||||
aDesiredSize.mOverflowArea = nsRect(0, 0, aDesiredSize.width, aDesiredSize.height);
|
||||
FinishAndStoreOverflow(&aDesiredSize);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsWidgetInitData*
|
||||
nsFormControlFrame::GetWidgetInitData(nsPresContext* aPresContext)
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsFormControlFrame::RegUnRegAccessKey(nsPresContext* aPresContext, nsIFrame * aFrame, PRBool aDoReg)
|
||||
{
|
||||
@ -522,31 +323,12 @@ nsFormControlFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEventStatus);
|
||||
if (nsEventStatus_eConsumeNoDefault == *aEventStatus) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Check for user-input:none style
|
||||
const nsStyleUserInterface* uiStyle = GetStyleUserInterface();
|
||||
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
|
||||
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE ||
|
||||
uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
||||
// if not native then use the NS_MOUSE_LEFT_CLICK to see if pressed
|
||||
// unfortunately native widgets don't seem to handle this right.
|
||||
// so use the old code for native stuff. -EDV
|
||||
switch (aEvent->message) {
|
||||
case NS_KEY_DOWN:
|
||||
if (NS_KEY_EVENT == aEvent->eventStructType) {
|
||||
nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent;
|
||||
if (NS_VK_RETURN == keyEvent->keyCode) {
|
||||
EnterPressed(aPresContext);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
*aEventStatus = nsEventStatus_eConsumeDoDefault;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -39,23 +39,11 @@
|
||||
#define nsFormControlFrame_h___
|
||||
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsFormControlHelper.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsLeafFrame.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsIView;
|
||||
class nsPresContext;
|
||||
class nsStyleCoord;
|
||||
|
||||
#define CSS_NOTSET -1
|
||||
#define ATTR_NOTSET -1
|
||||
|
||||
#define NS_FORMSIZE_NOTSET -1
|
||||
|
||||
#ifdef DEBUG_rods
|
||||
|
||||
#define COMPARE_QUIRK_SIZE(__class, __navWidth, __navHeight) \
|
||||
@ -125,33 +113,8 @@ public:
|
||||
|
||||
// new behavior
|
||||
|
||||
/**
|
||||
* Respond to a enter key being pressed
|
||||
*/
|
||||
virtual void EnterPressed(nsPresContext* aPresContext) {}
|
||||
|
||||
/**
|
||||
* Respond to a control change (e.g. combo box close-up)
|
||||
*/
|
||||
virtual void ControlChanged(nsPresContext* aPresContext) {}
|
||||
|
||||
virtual void SetFocus(PRBool aOn = PR_TRUE, PRBool aRepaint = PR_FALSE);
|
||||
|
||||
/**
|
||||
* Perform opertations before the widget associated with this frame has been
|
||||
* created.
|
||||
*/
|
||||
virtual nsWidgetInitData* GetWidgetInitData(nsPresContext* aPresContext);
|
||||
|
||||
void GetWidgetSize(nsSize& aSize) const { aSize.width = mWidgetSize.width;
|
||||
aSize.height = mWidgetSize.height; }
|
||||
|
||||
// XXX similar functionality needs to be added to widget library and these
|
||||
// need to change to use it.
|
||||
static nscoord GetScrollbarWidth(float aPixToTwip);
|
||||
|
||||
virtual void SetClickPoint(nscoord aX, nscoord aY);
|
||||
|
||||
/**
|
||||
* Get the width and height of this control based on CSS
|
||||
* @param aPresContext the presentation context
|
||||
@ -213,10 +176,6 @@ protected:
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize);
|
||||
|
||||
virtual void GetDesiredSize(nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredLayoutSize,
|
||||
nsSize& aDesiredWidgetSize);
|
||||
//
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Utility methods for managing checkboxes and radiobuttons
|
||||
@ -230,14 +189,7 @@ protected:
|
||||
|
||||
void GetCurrentCheckState(PRBool* aState);
|
||||
|
||||
nsSize mWidgetSize;
|
||||
PRBool mDidInit;
|
||||
nsPoint mLastClickPoint;
|
||||
|
||||
// Reflow Optimization
|
||||
nsSize mCacheSize;
|
||||
nscoord mCachedAscent;
|
||||
nscoord mCachedMaxElementWidth;
|
||||
|
||||
private:
|
||||
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include "nsITheme.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsFormControlHelper.h"
|
||||
|
||||
//------------------------------------------------------------
|
||||
nsIFrame*
|
||||
|
@ -139,21 +139,6 @@ nsGfxRadioControlFrame::SetRadioButtonFaceStyleContext(nsStyleContext *aRadioBut
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
NS_IMETHODIMP
|
||||
nsGfxRadioControlFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
// Check for user-input:none style
|
||||
const nsStyleUserInterface* uiStyle = GetStyleUserInterface();
|
||||
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
||||
// otherwise, do nothing. Events are handled by the DOM.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
void
|
||||
nsGfxRadioControlFrame::PaintRadioButtonFromStyle(
|
||||
|
@ -72,10 +72,6 @@ public:
|
||||
virtual void SetAdditionalStyleContext(PRInt32 aIndex,
|
||||
nsStyleContext* aStyleContext);
|
||||
|
||||
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus);
|
||||
|
||||
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsDisplayListSet& aLists);
|
||||
|
Loading…
Reference in New Issue
Block a user