зеркало из https://github.com/mozilla/gecko-dev.git
Added unconstrainted reflow optimizations
Also, commented out the adding of border-padding to the maxelementsize r=kmcclusk bug=12653
This commit is contained in:
Родитель
1648364918
Коммит
f5a6e0ef07
|
@ -53,6 +53,7 @@
|
|||
#include "nsColor.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsButtonFrameRenderer.h"
|
||||
#include "nsFormControlFrame.h"
|
||||
|
||||
static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID);
|
||||
static NS_DEFINE_IID(kIFormControlFrameIID, NS_IFORMCONTROLFRAME_IID);
|
||||
|
@ -82,6 +83,11 @@ nsHTMLButtonControlFrame::nsHTMLButtonControlFrame()
|
|||
mTranslatedRect = nsRect(0,0,0,0);
|
||||
mDidInit = PR_FALSE;
|
||||
mRenderer.SetNameSpace(kNameSpaceID_None);
|
||||
|
||||
mCacheSize.width = -1;
|
||||
mCacheSize.height = -1;
|
||||
mCachedMaxElementSize.width = -1;
|
||||
mCachedMaxElementSize.height = -1;
|
||||
}
|
||||
|
||||
nsHTMLButtonControlFrame::~nsHTMLButtonControlFrame()
|
||||
|
@ -510,6 +516,12 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
|||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
}
|
||||
|
||||
nsresult skiprv = nsFormControlFrame::SkipResizeReflow(mCacheSize, mCachedMaxElementSize, aPresContext,
|
||||
aDesiredSize, aReflowState, aStatus);
|
||||
if (NS_SUCCEEDED(skiprv)) {
|
||||
return skiprv;
|
||||
}
|
||||
|
||||
// XXX remove the following when the reflow state is fixed
|
||||
ButtonHack((nsHTMLReflowState&)aReflowState, "html4 button");
|
||||
|
||||
|
@ -642,15 +654,17 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
|||
//aDesiredSize.height += aReflowState.mComputedBorderPadding.top + aReflowState.mComputedBorderPadding.bottom;
|
||||
|
||||
//adjust our max element size, if necessary
|
||||
if (aDesiredSize.maxElementSize) {
|
||||
aDesiredSize.AddBorderPaddingToMaxElementSize(aReflowState.mComputedBorderPadding);
|
||||
}
|
||||
//if (aDesiredSize.maxElementSize) {
|
||||
//aDesiredSize.AddBorderPaddingToMaxElementSize(aReflowState.mComputedBorderPadding);
|
||||
//}
|
||||
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
|
||||
nsFormControlFrame::SetupCachedSizes(mCacheSize, mCachedMaxElementSize, aDesiredSize);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -155,6 +155,10 @@ protected:
|
|||
nsRect mTranslatedRect;
|
||||
PRBool mDidInit;
|
||||
nsButtonFrameRenderer mRenderer;
|
||||
|
||||
//Resize Reflow OpitmizationSize;
|
||||
nsSize mCacheSize;
|
||||
nsSize mCachedMaxElementSize;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "nsColor.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsButtonFrameRenderer.h"
|
||||
#include "nsFormControlFrame.h"
|
||||
|
||||
static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID);
|
||||
static NS_DEFINE_IID(kIFormControlFrameIID, NS_IFORMCONTROLFRAME_IID);
|
||||
|
@ -82,6 +83,11 @@ nsHTMLButtonControlFrame::nsHTMLButtonControlFrame()
|
|||
mTranslatedRect = nsRect(0,0,0,0);
|
||||
mDidInit = PR_FALSE;
|
||||
mRenderer.SetNameSpace(kNameSpaceID_None);
|
||||
|
||||
mCacheSize.width = -1;
|
||||
mCacheSize.height = -1;
|
||||
mCachedMaxElementSize.width = -1;
|
||||
mCachedMaxElementSize.height = -1;
|
||||
}
|
||||
|
||||
nsHTMLButtonControlFrame::~nsHTMLButtonControlFrame()
|
||||
|
@ -510,6 +516,12 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
|||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
}
|
||||
|
||||
nsresult skiprv = nsFormControlFrame::SkipResizeReflow(mCacheSize, mCachedMaxElementSize, aPresContext,
|
||||
aDesiredSize, aReflowState, aStatus);
|
||||
if (NS_SUCCEEDED(skiprv)) {
|
||||
return skiprv;
|
||||
}
|
||||
|
||||
// XXX remove the following when the reflow state is fixed
|
||||
ButtonHack((nsHTMLReflowState&)aReflowState, "html4 button");
|
||||
|
||||
|
@ -642,15 +654,17 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
|||
//aDesiredSize.height += aReflowState.mComputedBorderPadding.top + aReflowState.mComputedBorderPadding.bottom;
|
||||
|
||||
//adjust our max element size, if necessary
|
||||
if (aDesiredSize.maxElementSize) {
|
||||
aDesiredSize.AddBorderPaddingToMaxElementSize(aReflowState.mComputedBorderPadding);
|
||||
}
|
||||
//if (aDesiredSize.maxElementSize) {
|
||||
//aDesiredSize.AddBorderPaddingToMaxElementSize(aReflowState.mComputedBorderPadding);
|
||||
//}
|
||||
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
|
||||
nsFormControlFrame::SetupCachedSizes(mCacheSize, mCachedMaxElementSize, aDesiredSize);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -155,6 +155,10 @@ protected:
|
|||
nsRect mTranslatedRect;
|
||||
PRBool mDidInit;
|
||||
nsButtonFrameRenderer mRenderer;
|
||||
|
||||
//Resize Reflow OpitmizationSize;
|
||||
nsSize mCacheSize;
|
||||
nsSize mCachedMaxElementSize;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче