зеркало из https://github.com/mozilla/pjs.git
Changed nsLeafFrane's GetdesiredSize() to not pass in the max size
since it's now part of nsReflowState
This commit is contained in:
Родитель
a8489fba19
Коммит
6158f7cec4
|
@ -58,8 +58,7 @@ NS_METHOD nsLeafFrame::Reflow(nsIPresContext* aPresContext,
|
|||
// XXX add in code to check for width/height being set via css
|
||||
// and if set use them instead of calling GetDesiredSize.
|
||||
|
||||
GetDesiredSize(aPresContext, aReflowState,
|
||||
aReflowState.maxSize, aDesiredSize);
|
||||
GetDesiredSize(aPresContext, aReflowState, aDesiredSize);
|
||||
AddBordersAndPadding(aPresContext, aDesiredSize);
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
||||
|
|
|
@ -46,14 +46,13 @@ protected:
|
|||
virtual ~nsLeafFrame();
|
||||
|
||||
/**
|
||||
* Return the desired size of the frame. Note that this method
|
||||
* doesn't need to deal with padding or borders (the caller will
|
||||
* Return the desired size of the frame's content area. Note that this
|
||||
* method doesn't need to deal with padding or borders (the caller will
|
||||
* deal with it). In addition, the ascent will be set to the height
|
||||
* and the descent will be set to zero.
|
||||
*/
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredSize) = 0;
|
||||
|
||||
/**
|
||||
|
|
|
@ -81,7 +81,6 @@ protected:
|
|||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredSize);
|
||||
};
|
||||
|
||||
|
@ -227,7 +226,6 @@ HRuleFrame::Paint(nsIPresContext& aPresContext,
|
|||
void
|
||||
HRuleFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredSize)
|
||||
{
|
||||
nsStylePosition* position = (nsStylePosition*)
|
||||
|
@ -237,18 +235,18 @@ HRuleFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
}
|
||||
else if (position->mWidth.GetUnit() == eStyleUnit_Percent) {
|
||||
float pct = position->mWidth.GetPercentValue();
|
||||
aDesiredSize.width = nscoord(pct * aMaxSize.width);
|
||||
aDesiredSize.width = nscoord(pct * aReflowState.maxSize.width);
|
||||
}
|
||||
else {
|
||||
if (aMaxSize.width == NS_UNCONSTRAINEDSIZE) {
|
||||
if (aReflowState.maxSize.width == NS_UNCONSTRAINEDSIZE) {
|
||||
aDesiredSize.width = 1;
|
||||
} else {
|
||||
aDesiredSize.width = aMaxSize.width;
|
||||
aDesiredSize.width = aReflowState.maxSize.width;
|
||||
}
|
||||
}
|
||||
if (aMaxSize.width != NS_UNCONSTRAINEDSIZE) {
|
||||
if (aDesiredSize.width < aMaxSize.width) {
|
||||
aDesiredSize.width = aMaxSize.width;
|
||||
if (aReflowState.maxSize.width != NS_UNCONSTRAINEDSIZE) {
|
||||
if (aDesiredSize.width < aReflowState.maxSize.width) {
|
||||
aDesiredSize.width = aReflowState.maxSize.width;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,6 @@ public:
|
|||
protected:
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredSize);
|
||||
|
||||
/**
|
||||
|
@ -260,7 +259,7 @@ BulletFrame::Reflow(nsIPresContext* aCX,
|
|||
const nsReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
GetDesiredSize(aCX, aReflowState, aReflowState.maxSize, aDesiredSize);
|
||||
GetDesiredSize(aCX, aReflowState, aDesiredSize);
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
||||
aDesiredSize.maxElementSize->height = aDesiredSize.height;
|
||||
|
@ -494,7 +493,6 @@ BulletFrame::GetListItemText(nsIPresContext* aCX,
|
|||
void
|
||||
BulletFrame::GetDesiredSize(nsIPresContext* aCX,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredSize)
|
||||
{
|
||||
nsStyleList* myList =
|
||||
|
@ -505,7 +503,7 @@ BulletFrame::GetDesiredSize(nsIPresContext* aCX,
|
|||
nsIFontMetrics* fm = aCX->GetMetricsFor(myFont->mFont);
|
||||
if (myList->mListStyleImage.Length() > 0) {
|
||||
mImageLoader.SetURL(myList->mListStyleImage);
|
||||
mImageLoader.GetDesiredSize(aCX, aReflowState, aMaxSize, aDesiredSize);
|
||||
mImageLoader.GetDesiredSize(aCX, aReflowState, aDesiredSize);
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,6 @@ protected:
|
|||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredSize);
|
||||
|
||||
nsIImageMap* GetImageMap();
|
||||
|
@ -229,7 +228,6 @@ nsHTMLImageLoader::LoadImage(nsIPresContext* aPresContext,
|
|||
void
|
||||
nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredSize)
|
||||
{
|
||||
nsSize styleSize;
|
||||
|
@ -363,7 +361,6 @@ ImageFrame::DeleteFrame()
|
|||
void
|
||||
ImageFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredSize)
|
||||
{
|
||||
// Setup url before starting the image load
|
||||
|
@ -371,8 +368,7 @@ ImageFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
if (eContentAttr_HasValue == mContent->GetAttribute("SRC", src)) {
|
||||
mImageLoader.SetURL(src);
|
||||
}
|
||||
mImageLoader.GetDesiredSize(aPresContext, aReflowState,
|
||||
aMaxSize, aDesiredSize);
|
||||
mImageLoader.GetDesiredSize(aPresContext, aReflowState, aDesiredSize);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
|
|
|
@ -53,7 +53,6 @@ public:
|
|||
|
||||
void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredSize);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -58,8 +58,7 @@ NS_METHOD nsLeafFrame::Reflow(nsIPresContext* aPresContext,
|
|||
// XXX add in code to check for width/height being set via css
|
||||
// and if set use them instead of calling GetDesiredSize.
|
||||
|
||||
GetDesiredSize(aPresContext, aReflowState,
|
||||
aReflowState.maxSize, aDesiredSize);
|
||||
GetDesiredSize(aPresContext, aReflowState, aDesiredSize);
|
||||
AddBordersAndPadding(aPresContext, aDesiredSize);
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
||||
|
|
|
@ -46,14 +46,13 @@ protected:
|
|||
virtual ~nsLeafFrame();
|
||||
|
||||
/**
|
||||
* Return the desired size of the frame. Note that this method
|
||||
* doesn't need to deal with padding or borders (the caller will
|
||||
* Return the desired size of the frame's content area. Note that this
|
||||
* method doesn't need to deal with padding or borders (the caller will
|
||||
* deal with it). In addition, the ascent will be set to the height
|
||||
* and the descent will be set to zero.
|
||||
*/
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredSize) = 0;
|
||||
|
||||
/**
|
||||
|
|
|
@ -128,7 +128,6 @@ protected:
|
|||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredLayoutSize,
|
||||
nsSize& aDesiredWidgetSize);
|
||||
|
||||
|
@ -419,8 +418,7 @@ nsInputButtonFrame::Reflow(nsIPresContext* aPresContext,
|
|||
if ((kButtonTag_Input == GetButtonTagType()) &&
|
||||
(kButton_Image == GetButtonType())) {
|
||||
nsSize ignore;
|
||||
GetDesiredSize(aPresContext, aReflowState, aReflowState.maxSize,
|
||||
aDesiredSize, ignore);
|
||||
GetDesiredSize(aPresContext, aReflowState, aDesiredSize, ignore);
|
||||
AddBordersAndPadding(aPresContext, aDesiredSize);
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
||||
|
@ -438,7 +436,6 @@ nsInputButtonFrame::Reflow(nsIPresContext* aPresContext,
|
|||
void
|
||||
nsInputButtonFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredLayoutSize,
|
||||
nsSize& aDesiredWidgetSize)
|
||||
{
|
||||
|
@ -456,8 +453,7 @@ nsInputButtonFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
if (eContentAttr_HasValue == mContent->GetAttribute("SRC", src)) {
|
||||
mImageLoader.SetURL(src);
|
||||
}
|
||||
mImageLoader.GetDesiredSize(aPresContext, aReflowState, aMaxSize,
|
||||
aDesiredLayoutSize);
|
||||
mImageLoader.GetDesiredSize(aPresContext, aReflowState, aDesiredLayoutSize);
|
||||
}
|
||||
else { // there is a widget
|
||||
nsSize styleSize;
|
||||
|
|
|
@ -49,7 +49,7 @@ protected:
|
|||
virtual ~nsInputCheckboxFrame();
|
||||
PRBool mCacheState;
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsSize& aMaxSize,
|
||||
const nsReflowState& aReflowState,
|
||||
nsReflowMetrics& aDesiredLayoutSize,
|
||||
nsSize& aDesiredWidgetSize);
|
||||
};
|
||||
|
@ -93,7 +93,7 @@ PRInt32 nsInputCheckboxFrame::GetPadding() const
|
|||
|
||||
void
|
||||
nsInputCheckboxFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsSize& aMaxSize,
|
||||
const nsReflowState& aReflowState,
|
||||
nsReflowMetrics& aDesiredLayoutSize,
|
||||
nsSize& aDesiredWidgetSize)
|
||||
{
|
||||
|
@ -109,6 +109,8 @@ nsInputCheckboxFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
float p2t = aPresContext->GetPixelsToTwips();
|
||||
aDesiredWidgetSize.width = (int)(12 * p2t);
|
||||
aDesiredWidgetSize.height = (int)(12 * p2t);
|
||||
// XXX Why is padding being added? GetDesiredSize() as defined by nsLeafFrame
|
||||
// should return the size of the content area only...
|
||||
PRInt32 padding = GetPadding();
|
||||
aDesiredLayoutSize.width = aDesiredWidgetSize.width + (2 * padding);
|
||||
aDesiredLayoutSize.height = aDesiredWidgetSize.height;
|
||||
|
|
|
@ -190,7 +190,6 @@ nsInputFrame::IsHidden()
|
|||
void
|
||||
nsInputFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredLayoutSize,
|
||||
nsSize& aDesiredWidgetSize)
|
||||
{
|
||||
|
@ -210,11 +209,10 @@ nsInputFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
void
|
||||
nsInputFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredSize)
|
||||
{
|
||||
nsSize ignore;
|
||||
GetDesiredSize(aPresContext, aReflowState, aMaxSize, aDesiredSize, ignore);
|
||||
GetDesiredSize(aPresContext, aReflowState, aDesiredSize, ignore);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
|
@ -244,8 +242,7 @@ nsInputFrame::Reflow(nsIPresContext* aPresContext,
|
|||
nsIPresShell *presShell = aPresContext->GetShell(); // need to release
|
||||
nsIViewManager *viewMan = presShell->GetViewManager(); // need to release
|
||||
|
||||
GetDesiredSize(aPresContext, aReflowState, aReflowState.maxSize,
|
||||
aDesiredSize, mWidgetSize);
|
||||
GetDesiredSize(aPresContext, aReflowState, aDesiredSize, mWidgetSize);
|
||||
|
||||
//nsRect boundBox(0, 0, mWidgetSize.width, mWidgetSize.height);
|
||||
nsRect boundBox(0, 0, aDesiredSize.width, aDesiredSize.height);
|
||||
|
@ -292,8 +289,7 @@ nsInputFrame::Reflow(nsIPresContext* aPresContext,
|
|||
NS_IF_RELEASE(presShell);
|
||||
}
|
||||
else {
|
||||
GetDesiredSize(aPresContext, aReflowState, aReflowState.maxSize,
|
||||
aDesiredSize, mWidgetSize);
|
||||
GetDesiredSize(aPresContext, aReflowState, aDesiredSize, mWidgetSize);
|
||||
|
||||
// If we are being reflowed and have a view, hide the view until
|
||||
// we are told to paint (which is when our location will have
|
||||
|
|
|
@ -190,12 +190,10 @@ protected:
|
|||
*/
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredSize);
|
||||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredLayoutSize,
|
||||
nsSize& aDesiredWidgetSize);
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ protected:
|
|||
virtual ~nsInputRadioFrame();
|
||||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsSize& aMaxSize,
|
||||
const nsReflowState& aReflowState,
|
||||
nsReflowMetrics& aDesiredLayoutSize,
|
||||
nsSize& aDesiredWidgetSize);
|
||||
};
|
||||
|
@ -96,7 +96,7 @@ nsInputRadioFrame::GetCID()
|
|||
|
||||
void
|
||||
nsInputRadioFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsSize& aMaxSize,
|
||||
const nsReflowState& aReflowState,
|
||||
nsReflowMetrics& aDesiredLayoutSize,
|
||||
nsSize& aDesiredWidgetSize)
|
||||
{
|
||||
|
@ -104,6 +104,8 @@ nsInputRadioFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
aDesiredWidgetSize.width = (int)(12 * p2t);
|
||||
aDesiredWidgetSize.height = (int)(12 * p2t);
|
||||
PRInt32 padding = GetPadding();
|
||||
// XXX Why is padding being added? GetDesiredSize() as defined by nsLeafFrame
|
||||
// should return the size of the content area only...
|
||||
aDesiredLayoutSize.width = aDesiredWidgetSize.width + (2 * padding);
|
||||
aDesiredLayoutSize.height = aDesiredWidgetSize.height;
|
||||
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
|
||||
|
|
|
@ -62,7 +62,6 @@ protected:
|
|||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredLayoutSize,
|
||||
nsSize& aDesiredWidgetSize);
|
||||
PRBool mIsComboBox;
|
||||
|
@ -178,7 +177,6 @@ nsSelectFrame::GetCID()
|
|||
void
|
||||
nsSelectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsReflowState& aReflowState,
|
||||
const nsSize& aMaxSize,
|
||||
nsReflowMetrics& aDesiredLayoutSize,
|
||||
nsSize& aDesiredWidgetSize)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче