зеркало из https://github.com/mozilla/gecko-dev.git
Bug 243370, deCOMtaminate parts of nsIFrame that come from nsIBox, part 2, p=anlan@lange.cx, r+sr=roc
This commit is contained in:
Родитель
8a4b57e4d0
Коммит
b3361bf8f9
|
@ -346,9 +346,7 @@ nsIFrame* nsDisplayList::HitTest(nsDisplayListBuilder* aBuilder, nsPoint aPt) co
|
||||||
nsIFrame* f = item->HitTest(aBuilder, aPt);
|
nsIFrame* f = item->HitTest(aBuilder, aPt);
|
||||||
// Handle the XUL 'mousethrough' feature.
|
// Handle the XUL 'mousethrough' feature.
|
||||||
if (f) {
|
if (f) {
|
||||||
PRBool mouseThrough = PR_FALSE;
|
if (!f->GetMouseThrough())
|
||||||
f->GetMouseThrough(mouseThrough);
|
|
||||||
if (!mouseThrough)
|
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1821,28 +1821,25 @@ nsTextControlFrame::GetMaxSize(nsBoxLayoutState& aState)
|
||||||
return nsBox::GetMaxSize(aState);
|
return nsBox::GetMaxSize(aState);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nscoord
|
||||||
nsTextControlFrame::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent)
|
nsTextControlFrame::GetBoxAscent(nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
// First calculate the ascent of the text inside
|
// First calculate the ascent of the text inside
|
||||||
nsresult rv = nsStackFrame::GetAscent(aState, aAscent);
|
nscoord ascent = nsStackFrame::GetBoxAscent(aState);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
// Now adjust the ascent for our borders and padding
|
// Now adjust the ascent for our borders and padding
|
||||||
nsMargin borderPadding;
|
nsMargin borderPadding;
|
||||||
GetBorderAndPadding(borderPadding);
|
GetBorderAndPadding(borderPadding);
|
||||||
aAscent += borderPadding.top;
|
ascent += borderPadding.top;
|
||||||
|
|
||||||
return NS_OK;
|
return ascent;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRBool
|
||||||
nsTextControlFrame::IsCollapsed(nsBoxLayoutState& aBoxLayoutState,
|
nsTextControlFrame::IsCollapsed(nsBoxLayoutState& aBoxLayoutState)
|
||||||
PRBool& aCollapsed)
|
|
||||||
{
|
{
|
||||||
// We're never collapsed in the box sense.
|
// We're never collapsed in the box sense.
|
||||||
aCollapsed = PR_FALSE;
|
return PR_FALSE;
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
|
|
|
@ -89,9 +89,8 @@ public:
|
||||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
||||||
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
||||||
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
||||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
|
virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState);
|
||||||
NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState,
|
virtual PRBool IsCollapsed(nsBoxLayoutState& aBoxLayoutState);
|
||||||
PRBool& aCollapsed);
|
|
||||||
|
|
||||||
DECL_DO_GLOBAL_REFLOW_COUNT_DSP(nsTextControlFrame, nsStackFrame)
|
DECL_DO_GLOBAL_REFLOW_COUNT_DSP(nsTextControlFrame, nsStackFrame)
|
||||||
|
|
||||||
|
|
|
@ -146,9 +146,7 @@ struct nsBoxLayoutMetrics
|
||||||
nscoord mAscent;
|
nscoord mAscent;
|
||||||
|
|
||||||
nsSize mLastSize;
|
nsSize mLastSize;
|
||||||
nsSize mOverflow;
|
|
||||||
|
|
||||||
PRPackedBool mIncludeOverflow;
|
|
||||||
PRPackedBool mWasCollapsed;
|
PRPackedBool mWasCollapsed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5772,20 +5770,6 @@ void nsFrame::FillCursorInformationFromStyle(const nsStyleUserInterface* ui,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFrame::GetOverflow(nsSize& aOverflow)
|
|
||||||
{
|
|
||||||
aOverflow = BoxMetrics()->mOverflow;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFrame::SetIncludeOverflow(PRBool aInclude)
|
|
||||||
{
|
|
||||||
BoxMetrics()->mIncludeOverflow = aInclude;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsFrame::RefreshSizeCache(nsBoxLayoutState& aState)
|
nsFrame::RefreshSizeCache(nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
|
@ -5900,9 +5884,7 @@ nsFrame::GetPrefSize(nsBoxLayoutState& aState)
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool isCollapsed = PR_FALSE;
|
if (IsCollapsed(aState))
|
||||||
IsCollapsed(aState, isCollapsed);
|
|
||||||
if (isCollapsed)
|
|
||||||
return size;
|
return size;
|
||||||
|
|
||||||
// get our size in CSS.
|
// get our size in CSS.
|
||||||
|
@ -5936,9 +5918,7 @@ nsFrame::GetMinSize(nsBoxLayoutState& aState)
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool isCollapsed = PR_FALSE;
|
if (IsCollapsed(aState))
|
||||||
IsCollapsed(aState, isCollapsed);
|
|
||||||
if (isCollapsed)
|
|
||||||
return size;
|
return size;
|
||||||
|
|
||||||
// get our size in CSS.
|
// get our size in CSS.
|
||||||
|
@ -5968,9 +5948,7 @@ nsFrame::GetMaxSize(nsBoxLayoutState& aState)
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool isCollapsed = PR_FALSE;
|
if (IsCollapsed(aState))
|
||||||
IsCollapsed(aState, isCollapsed);
|
|
||||||
if (isCollapsed)
|
|
||||||
return size;
|
return size;
|
||||||
|
|
||||||
size = nsBox::GetMaxSize(aState);
|
size = nsBox::GetMaxSize(aState);
|
||||||
|
@ -5979,35 +5957,26 @@ nsFrame::GetMaxSize(nsBoxLayoutState& aState)
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nscoord
|
||||||
nsFrame::GetFlex(nsBoxLayoutState& aState, nscoord& aFlex)
|
nsFrame::GetFlex(nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
nsBoxLayoutMetrics *metrics = BoxMetrics();
|
nsBoxLayoutMetrics *metrics = BoxMetrics();
|
||||||
if (!DoesNeedRecalc(metrics->mFlex)) {
|
if (!DoesNeedRecalc(metrics->mFlex))
|
||||||
aFlex = metrics->mFlex;
|
return metrics->mFlex;
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
metrics->mFlex = 0;
|
metrics->mFlex = nsBox::GetFlex(aState);
|
||||||
nsBox::GetFlex(aState, metrics->mFlex);
|
|
||||||
|
|
||||||
aFlex = metrics->mFlex;
|
return metrics->mFlex;
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nscoord
|
||||||
nsFrame::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent)
|
nsFrame::GetBoxAscent(nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
nsBoxLayoutMetrics *metrics = BoxMetrics();
|
nsBoxLayoutMetrics *metrics = BoxMetrics();
|
||||||
if (!DoesNeedRecalc(metrics->mAscent)) {
|
if (!DoesNeedRecalc(metrics->mAscent))
|
||||||
aAscent = metrics->mAscent;
|
return metrics->mAscent;
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool isCollapsed = PR_FALSE;
|
if (IsCollapsed(aState)) {
|
||||||
IsCollapsed(aState, isCollapsed);
|
|
||||||
if (isCollapsed) {
|
|
||||||
metrics->mAscent = 0;
|
metrics->mAscent = 0;
|
||||||
} else {
|
} else {
|
||||||
// Refresh our caches with new sizes.
|
// Refresh our caches with new sizes.
|
||||||
|
@ -6018,9 +5987,7 @@ nsFrame::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent)
|
||||||
metrics->mAscent += m.top;
|
metrics->mAscent += m.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
aAscent = metrics->mAscent;
|
return metrics->mAscent;
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -6038,9 +6005,7 @@ nsFrame::DoLayout(nsBoxLayoutState& aState)
|
||||||
rv = BoxReflow(aState, presContext, desiredSize, rendContext,
|
rv = BoxReflow(aState, presContext, desiredSize, rendContext,
|
||||||
ourRect.x, ourRect.y, ourRect.width, ourRect.height);
|
ourRect.x, ourRect.y, ourRect.width, ourRect.height);
|
||||||
|
|
||||||
PRBool collapsed = PR_FALSE;
|
if (IsCollapsed(aState)) {
|
||||||
IsCollapsed(aState, collapsed);
|
|
||||||
if (collapsed) {
|
|
||||||
SetSize(nsSize(0, 0));
|
SetSize(nsSize(0, 0));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -6248,11 +6213,7 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
|
||||||
// This kinda sucks. We should be able to handle the case
|
// This kinda sucks. We should be able to handle the case
|
||||||
// where there's overflow above or to the left of the
|
// where there's overflow above or to the left of the
|
||||||
// origin. But for now just chop that stuff off.
|
// origin. But for now just chop that stuff off.
|
||||||
metrics->mOverflow.width = aDesiredSize.mOverflowArea.XMost();
|
|
||||||
metrics->mOverflow.height = aDesiredSize.mOverflowArea.YMost();
|
|
||||||
|
|
||||||
// include the overflow size in our child's rect?
|
|
||||||
if (metrics->mIncludeOverflow) {
|
|
||||||
//printf("OutsideChildren width=%d, height=%d\n", aDesiredSize.mOverflowArea.width, aDesiredSize.mOverflowArea.height);
|
//printf("OutsideChildren width=%d, height=%d\n", aDesiredSize.mOverflowArea.width, aDesiredSize.mOverflowArea.height);
|
||||||
aDesiredSize.width = aDesiredSize.mOverflowArea.XMost();
|
aDesiredSize.width = aDesiredSize.mOverflowArea.XMost();
|
||||||
if (aDesiredSize.width <= aWidth)
|
if (aDesiredSize.width <= aWidth)
|
||||||
|
@ -6280,10 +6241,6 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
metrics->mOverflow.width = aDesiredSize.width;
|
|
||||||
metrics->mOverflow.height = aDesiredSize.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (redrawAfterReflow) {
|
if (redrawAfterReflow) {
|
||||||
nsRect r = GetRect();
|
nsRect r = GetRect();
|
||||||
|
@ -6302,9 +6259,7 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
|
||||||
aDesiredSize, aX, aY, layoutFlags | NS_FRAME_NO_MOVE_FRAME);
|
aDesiredSize, aX, aY, layoutFlags | NS_FRAME_NO_MOVE_FRAME);
|
||||||
|
|
||||||
// Save the ascent. (bug 103925)
|
// Save the ascent. (bug 103925)
|
||||||
PRBool isCollapsed = PR_FALSE;
|
if (IsCollapsed(aState)) {
|
||||||
IsCollapsed(aState, isCollapsed);
|
|
||||||
if (isCollapsed) {
|
|
||||||
metrics->mAscent = 0;
|
metrics->mAscent = 0;
|
||||||
} else {
|
} else {
|
||||||
if (aDesiredSize.ascent == nsHTMLReflowMetrics::ASK_FOR_BASELINE) {
|
if (aDesiredSize.ascent == nsHTMLReflowMetrics::ASK_FOR_BASELINE) {
|
||||||
|
@ -6381,9 +6336,7 @@ nsFrame::SetParent(const nsIFrame* aParent)
|
||||||
DeleteProperty(nsGkAtoms::boxMetricsProperty);
|
DeleteProperty(nsGkAtoms::boxMetricsProperty);
|
||||||
|
|
||||||
if (aParent && aParent->IsBoxFrame()) {
|
if (aParent && aParent->IsBoxFrame()) {
|
||||||
PRBool needsWidget = PR_FALSE;
|
if (aParent->ChildrenMustHaveWidgets()) {
|
||||||
aParent->ChildrenMustHaveWidgets(needsWidget);
|
|
||||||
if (needsWidget) {
|
|
||||||
nsHTMLContainerFrame::CreateViewForFrame(this, nsnull, PR_TRUE);
|
nsHTMLContainerFrame::CreateViewForFrame(this, nsnull, PR_TRUE);
|
||||||
nsIView* view = GetView();
|
nsIView* view = GetView();
|
||||||
if (!view->HasWidget())
|
if (!view->HasWidget())
|
||||||
|
@ -6415,8 +6368,6 @@ nsFrame::InitBoxMetrics(PRBool aClear)
|
||||||
nsFrame::MarkIntrinsicWidthsDirty();
|
nsFrame::MarkIntrinsicWidthsDirty();
|
||||||
metrics->mBlockAscent = 0;
|
metrics->mBlockAscent = 0;
|
||||||
metrics->mLastSize.SizeTo(0, 0);
|
metrics->mLastSize.SizeTo(0, 0);
|
||||||
metrics->mOverflow.SizeTo(0, 0);
|
|
||||||
metrics->mIncludeOverflow = PR_TRUE;
|
|
||||||
metrics->mWasCollapsed = PR_FALSE;
|
metrics->mWasCollapsed = PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -363,10 +363,8 @@ public:
|
||||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
||||||
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
||||||
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
||||||
NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex);
|
virtual nscoord GetFlex(nsBoxLayoutState& aBoxLayoutState);
|
||||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
|
virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState);
|
||||||
NS_IMETHOD SetIncludeOverflow(PRBool aInclude);
|
|
||||||
NS_IMETHOD GetOverflow(nsSize& aOverflow);
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// Additional methods
|
// Additional methods
|
||||||
|
|
|
@ -1041,23 +1041,22 @@ nsXULScrollFrame::GetType() const
|
||||||
return nsGkAtoms::scrollFrame;
|
return nsGkAtoms::scrollFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nscoord
|
||||||
nsXULScrollFrame::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent)
|
nsXULScrollFrame::GetBoxAscent(nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
aAscent = 0;
|
|
||||||
if (!mInner.mScrolledFrame)
|
if (!mInner.mScrolledFrame)
|
||||||
return NS_OK;
|
return 0;
|
||||||
|
|
||||||
nsresult rv = mInner.mScrolledFrame->GetAscent(aState, aAscent);
|
nscoord ascent = mInner.mScrolledFrame->GetBoxAscent(aState);
|
||||||
nsMargin m(0,0,0,0);
|
nsMargin m(0,0,0,0);
|
||||||
GetBorderAndPadding(m);
|
GetBorderAndPadding(m);
|
||||||
aAscent += m.top;
|
ascent += m.top;
|
||||||
GetMargin(m);
|
GetMargin(m);
|
||||||
aAscent += m.top;
|
ascent += m.top;
|
||||||
GetInset(m);
|
GetInset(m);
|
||||||
aAscent += m.top;
|
ascent += m.top;
|
||||||
|
|
||||||
return rv;
|
return ascent;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSize
|
nsSize
|
||||||
|
|
|
@ -478,7 +478,7 @@ public:
|
||||||
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
||||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
||||||
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
||||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
|
virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState);
|
||||||
|
|
||||||
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
||||||
NS_IMETHOD GetPadding(nsMargin& aPadding);
|
NS_IMETHOD GetPadding(nsMargin& aPadding);
|
||||||
|
|
|
@ -100,10 +100,10 @@ struct nsMargin;
|
||||||
typedef class nsIFrame nsIBox;
|
typedef class nsIFrame nsIBox;
|
||||||
|
|
||||||
// IID for the nsIFrame interface
|
// IID for the nsIFrame interface
|
||||||
// f02b2868-ac80-4e38-978c-02df6477d294
|
// 4ea7876f-1550-40d4-a764-739a0e4289a1
|
||||||
#define NS_IFRAME_IID \
|
#define NS_IFRAME_IID \
|
||||||
{ 0xf02b2868, 0xac80, 0x4e38, \
|
{ 0x4ea7876f, 0x1550, 0x40d4, \
|
||||||
{ 0x97, 0x8c, 0x02, 0xdf, 0x64, 0x77, 0xd2, 0x94 } }
|
{ 0xa7, 0x64, 0x73, 0x9a, 0x0e, 0x42, 0x89, 0xa1 } }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indication of how the frame can be split. This is used when doing runaround
|
* Indication of how the frame can be split. This is used when doing runaround
|
||||||
|
@ -1845,18 +1845,18 @@ NS_PTR_TO_INT32(frame->GetProperty(nsGkAtoms::embeddingLevel))
|
||||||
*/
|
*/
|
||||||
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState) = 0;
|
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState) = 0;
|
||||||
|
|
||||||
NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex)=0;
|
|
||||||
NS_HIDDEN_(nsresult)
|
|
||||||
GetOrdinal(nsBoxLayoutState& aBoxLayoutState, PRUint32& aOrdinal);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This returns the minimum size for the scroll area if this frame is
|
* This returns the minimum size for the scroll area if this frame is
|
||||||
* being scrolled. Usually it's (0,0).
|
* being scrolled. Usually it's (0,0).
|
||||||
*/
|
*/
|
||||||
virtual nsSize GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState) = 0;
|
virtual nsSize GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState) = 0;
|
||||||
|
|
||||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent)=0;
|
// Implemented in nsBox, used in nsBoxFrame
|
||||||
NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed)=0;
|
PRUint32 GetOrdinal(nsBoxLayoutState& aBoxLayoutState);
|
||||||
|
|
||||||
|
virtual nscoord GetFlex(nsBoxLayoutState& aBoxLayoutState) = 0;
|
||||||
|
virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState) = 0;
|
||||||
|
virtual PRBool IsCollapsed(nsBoxLayoutState& aBoxLayoutState) = 0;
|
||||||
// This does not alter the overflow area. If the caller is changing
|
// This does not alter the overflow area. If the caller is changing
|
||||||
// the box size, the caller is responsible for updating the overflow
|
// the box size, the caller is responsible for updating the overflow
|
||||||
// area. It's enough to just call Layout or SyncLayout on the
|
// area. It's enough to just call Layout or SyncLayout on the
|
||||||
|
@ -1891,24 +1891,16 @@ NS_PTR_TO_INT32(frame->GetProperty(nsGkAtoms::embeddingLevel))
|
||||||
NS_IMETHOD GetMargin(nsMargin& aMargin)=0;
|
NS_IMETHOD GetMargin(nsMargin& aMargin)=0;
|
||||||
NS_IMETHOD SetLayoutManager(nsIBoxLayout* aLayout)=0;
|
NS_IMETHOD SetLayoutManager(nsIBoxLayout* aLayout)=0;
|
||||||
NS_IMETHOD GetLayoutManager(nsIBoxLayout** aLayout)=0;
|
NS_IMETHOD GetLayoutManager(nsIBoxLayout** aLayout)=0;
|
||||||
NS_HIDDEN_(nsresult) GetContentRect(nsRect& aContentRect);
|
|
||||||
NS_HIDDEN_(nsresult) GetClientRect(nsRect& aContentRect);
|
NS_HIDDEN_(nsresult) GetClientRect(nsRect& aContentRect);
|
||||||
NS_IMETHOD GetVAlign(Valignment& aAlign) = 0;
|
NS_IMETHOD GetVAlign(Valignment& aAlign) = 0;
|
||||||
NS_IMETHOD GetHAlign(Halignment& aAlign) = 0;
|
NS_IMETHOD GetHAlign(Halignment& aAlign) = 0;
|
||||||
|
|
||||||
PRBool IsHorizontal() const { return (mState & NS_STATE_IS_HORIZONTAL) != 0; }
|
PRBool IsHorizontal() const { return (mState & NS_STATE_IS_HORIZONTAL) != 0; }
|
||||||
nsresult GetOrientation(PRBool& aIsHorizontal) /// XXX to be removed
|
|
||||||
{ aIsHorizontal = IsHorizontal(); return NS_OK; }
|
|
||||||
|
|
||||||
PRBool IsNormalDirection() const { return (mState & NS_STATE_IS_DIRECTION_NORMAL) != 0; }
|
PRBool IsNormalDirection() const { return (mState & NS_STATE_IS_DIRECTION_NORMAL) != 0; }
|
||||||
nsresult GetDirection(PRBool& aIsNormal) /// XXX to be removed
|
|
||||||
{ aIsNormal = IsNormalDirection(); return NS_OK; }
|
|
||||||
|
|
||||||
NS_HIDDEN_(nsresult) Redraw(nsBoxLayoutState& aState, const nsRect* aRect = nsnull, PRBool aImmediate = PR_FALSE);
|
NS_HIDDEN_(nsresult) Redraw(nsBoxLayoutState& aState, const nsRect* aRect = nsnull, PRBool aImmediate = PR_FALSE);
|
||||||
NS_IMETHOD RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild)=0;
|
NS_IMETHOD RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild)=0;
|
||||||
NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough)=0;
|
virtual PRBool GetMouseThrough() const = 0;
|
||||||
NS_IMETHOD SetIncludeOverflow(PRBool aInclude) = 0;
|
|
||||||
NS_IMETHOD GetOverflow(nsSize& aOverflow) = 0;
|
|
||||||
|
|
||||||
#ifdef DEBUG_LAYOUT
|
#ifdef DEBUG_LAYOUT
|
||||||
NS_IMETHOD SetDebug(nsBoxLayoutState& aState, PRBool aDebug)=0;
|
NS_IMETHOD SetDebug(nsBoxLayoutState& aState, PRBool aDebug)=0;
|
||||||
|
@ -1916,8 +1908,9 @@ NS_PTR_TO_INT32(frame->GetProperty(nsGkAtoms::embeddingLevel))
|
||||||
|
|
||||||
NS_IMETHOD DumpBox(FILE* out)=0;
|
NS_IMETHOD DumpBox(FILE* out)=0;
|
||||||
#endif
|
#endif
|
||||||
NS_IMETHOD ChildrenMustHaveWidgets(PRBool& aMust) const=0;
|
|
||||||
NS_IMETHOD GetIndexOf(nsIBox* aChild, PRInt32* aIndex)=0;
|
// Only nsDeckFrame requires that all its children have widgets
|
||||||
|
virtual PRBool ChildrenMustHaveWidgets() const { return PR_FALSE; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return PR_TRUE if this text frame ends with a newline character. It
|
* @return PR_TRUE if this text frame ends with a newline character. It
|
||||||
|
|
|
@ -749,12 +749,8 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n
|
||||||
// borders padding and insets into account
|
// borders padding and insets into account
|
||||||
if (box && !row->mIsBogus)
|
if (box && !row->mIsBogus)
|
||||||
{
|
{
|
||||||
PRBool isCollapsed = PR_FALSE;
|
if (!box->IsCollapsed(aState))
|
||||||
box->IsCollapsed(aState, isCollapsed);
|
|
||||||
|
|
||||||
if (!isCollapsed)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
box->GetInset(inset);
|
box->GetInset(inset);
|
||||||
|
|
||||||
// get real border and padding. GetBorderAndPadding
|
// get real border and padding. GetBorderAndPadding
|
||||||
|
@ -823,9 +819,7 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n
|
||||||
if (box)
|
if (box)
|
||||||
{
|
{
|
||||||
// ignore collapsed children
|
// ignore collapsed children
|
||||||
box->IsCollapsed(aState, isCollapsed);
|
if (!box->IsCollapsed(aState))
|
||||||
|
|
||||||
if (!isCollapsed)
|
|
||||||
{
|
{
|
||||||
// include the margin of the columns. To the row
|
// include the margin of the columns. To the row
|
||||||
// at this point border/padding and margins all added
|
// at this point border/padding and margins all added
|
||||||
|
@ -1222,8 +1216,7 @@ nsGrid::GetRowFlex(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsHorizonta
|
||||||
// not flexible.
|
// not flexible.
|
||||||
if (parentsParent) {
|
if (parentsParent) {
|
||||||
if (!IsGrid(parentsParent)) {
|
if (!IsGrid(parentsParent)) {
|
||||||
nscoord flex = 0;
|
nscoord flex = parent->GetFlex(aState);
|
||||||
parent->GetFlex(aState, flex);
|
|
||||||
nsIBox::AddCSSFlex(aState, parent, flex);
|
nsIBox::AddCSSFlex(aState, parent, flex);
|
||||||
if (flex == 0) {
|
if (flex == 0) {
|
||||||
row->mFlex = 0;
|
row->mFlex = 0;
|
||||||
|
@ -1237,9 +1230,8 @@ nsGrid::GetRowFlex(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsHorizonta
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the row flex.
|
// get the row flex.
|
||||||
box->GetFlex(aState, row->mFlex);
|
row->mFlex = box->GetFlex(aState);
|
||||||
nsIBox::AddCSSFlex(aState, box, row->mFlex);
|
nsIBox::AddCSSFlex(aState, box, row->mFlex);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return row->mFlex;
|
return row->mFlex;
|
||||||
|
|
|
@ -152,15 +152,8 @@ nsGridCell::GetMaxSize(nsBoxLayoutState& aState)
|
||||||
PRBool
|
PRBool
|
||||||
nsGridCell::IsCollapsed(nsBoxLayoutState& aState)
|
nsGridCell::IsCollapsed(nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
PRBool c1 = PR_FALSE, c2 = PR_FALSE;
|
return ((mBoxInColumn && mBoxInColumn->IsCollapsed(aState)) ||
|
||||||
|
(mBoxInRow && mBoxInRow->IsCollapsed(aState)));
|
||||||
if (mBoxInColumn)
|
|
||||||
mBoxInColumn->IsCollapsed(aState, c1);
|
|
||||||
|
|
||||||
if (mBoxInRow)
|
|
||||||
mBoxInRow->IsCollapsed(aState, c2);
|
|
||||||
|
|
||||||
return (c1 || c2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -100,11 +100,6 @@ nsGridRow::MarkDirty(nsBoxLayoutState& aState)
|
||||||
PRBool
|
PRBool
|
||||||
nsGridRow::IsCollapsed(nsBoxLayoutState& aState)
|
nsGridRow::IsCollapsed(nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
PRBool isCollapsed = PR_FALSE;
|
return mBox && mBox->IsCollapsed(aState);
|
||||||
|
|
||||||
if (mBox)
|
|
||||||
mBox->IsCollapsed(aState,isCollapsed);
|
|
||||||
|
|
||||||
return isCollapsed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,23 +64,18 @@ NS_NewGridRowGroupFrame (nsIPresShell* aPresShell,
|
||||||
* This is redefined because row groups have a funny property. If they are flexible
|
* This is redefined because row groups have a funny property. If they are flexible
|
||||||
* then their flex must be equal to the sum of their children's flexes.
|
* then their flex must be equal to the sum of their children's flexes.
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP
|
nscoord
|
||||||
nsGridRowGroupFrame::GetFlex(nsBoxLayoutState& aState, nscoord& aFlex)
|
nsGridRowGroupFrame::GetFlex(nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
// if we are flexible out flexibility is determined by our columns.
|
// if we are flexible out flexibility is determined by our columns.
|
||||||
// so first get the our flex. If not 0 then our flex is the sum of
|
// so first get the our flex. If not 0 then our flex is the sum of
|
||||||
// our columns flexes.
|
// our columns flexes.
|
||||||
|
|
||||||
if (!DoesNeedRecalc(mFlex)) {
|
if (!DoesNeedRecalc(mFlex))
|
||||||
aFlex = mFlex;
|
return mFlex;
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsBoxFrame::GetFlex(aState, aFlex);
|
if (nsBoxFrame::GetFlex(aState) == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (aFlex == 0)
|
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
// ok we are flexible add up our children
|
// ok we are flexible add up our children
|
||||||
nscoord totalFlex = 0;
|
nscoord totalFlex = 0;
|
||||||
|
@ -88,16 +83,13 @@ nsGridRowGroupFrame::GetFlex(nsBoxLayoutState& aState, nscoord& aFlex)
|
||||||
GetChildBox(&child);
|
GetChildBox(&child);
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
PRInt32 flex = 0;
|
totalFlex += child->GetFlex(aState);
|
||||||
child->GetFlex(aState, flex);
|
|
||||||
totalFlex += flex;;
|
|
||||||
child->GetNextBox(&child);
|
child->GetNextBox(&child);
|
||||||
}
|
}
|
||||||
|
|
||||||
aFlex = totalFlex;
|
mFlex = totalFlex;
|
||||||
mFlex = aFlex;
|
|
||||||
|
|
||||||
return NS_OK;
|
return totalFlex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ public:
|
||||||
nsIBoxLayout* aLayoutManager):
|
nsIBoxLayout* aLayoutManager):
|
||||||
nsBoxFrame(aPresShell, aContext, aIsRoot, aLayoutManager) {}
|
nsBoxFrame(aPresShell, aContext, aIsRoot, aLayoutManager) {}
|
||||||
|
|
||||||
NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex);
|
virtual nscoord GetFlex(nsBoxLayoutState& aBoxLayoutState);
|
||||||
|
|
||||||
}; // class nsGridRowGroupFrame
|
}; // class nsGridRowGroupFrame
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ nsGridRowLeafLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, ns
|
||||||
nscoord bottomMargin = column->mBottomMargin;
|
nscoord bottomMargin = column->mBottomMargin;
|
||||||
|
|
||||||
if (box)
|
if (box)
|
||||||
box->IsCollapsed(aState, collapsed);
|
collapsed = box->IsCollapsed(aState);
|
||||||
|
|
||||||
pref = pref - (left + right);
|
pref = pref - (left + right);
|
||||||
if (pref < 0)
|
if (pref < 0)
|
||||||
|
@ -264,9 +264,6 @@ nsGridRowLeafLayout::ComputeChildSizes(nsIBox* aBox,
|
||||||
if (aBox) {
|
if (aBox) {
|
||||||
|
|
||||||
// go up the parent chain looking for scrollframes
|
// go up the parent chain looking for scrollframes
|
||||||
PRBool isHorizontal = PR_FALSE;
|
|
||||||
aBox->GetOrientation(isHorizontal);
|
|
||||||
|
|
||||||
nsIBox* scrollbox = nsnull;
|
nsIBox* scrollbox = nsnull;
|
||||||
aBox->GetParentBox(&aBox);
|
aBox->GetParentBox(&aBox);
|
||||||
scrollbox = nsGrid::GetScrollBox(aBox);
|
scrollbox = nsGrid::GetScrollBox(aBox);
|
||||||
|
@ -283,7 +280,7 @@ nsGridRowLeafLayout::ComputeChildSizes(nsIBox* aBox,
|
||||||
ourRect.Deflate(padding);
|
ourRect.Deflate(padding);
|
||||||
|
|
||||||
nscoord diff;
|
nscoord diff;
|
||||||
if (isHorizontal) {
|
if (aBox->IsHorizontal()) {
|
||||||
diff = scrollbarSizes.left + scrollbarSizes.right;
|
diff = scrollbarSizes.left + scrollbarSizes.right;
|
||||||
} else {
|
} else {
|
||||||
diff = scrollbarSizes.top + scrollbarSizes.bottom;
|
diff = scrollbarSizes.top + scrollbarSizes.bottom;
|
||||||
|
|
|
@ -151,16 +151,6 @@ nsBox::PropagateDebug(nsBoxLayoutState& aState)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* Hack for deck who requires that all its children has widgets
|
|
||||||
*/
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsBox::ChildrenMustHaveWidgets(PRBool& aMust) const
|
|
||||||
{
|
|
||||||
aMust = PR_FALSE;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG_LAYOUT
|
#ifdef DEBUG_LAYOUT
|
||||||
void
|
void
|
||||||
nsBox::GetBoxName(nsAutoString& aName)
|
nsBox::GetBoxName(nsAutoString& aName)
|
||||||
|
@ -280,7 +270,8 @@ nsBox::GetHAlign(Halignment& aAlign)
|
||||||
nsresult
|
nsresult
|
||||||
nsIFrame::GetClientRect(nsRect& aClientRect)
|
nsIFrame::GetClientRect(nsRect& aClientRect)
|
||||||
{
|
{
|
||||||
GetContentRect(aClientRect);
|
aClientRect = mRect;
|
||||||
|
aClientRect.MoveTo(0,0);
|
||||||
|
|
||||||
nsMargin borderPadding;
|
nsMargin borderPadding;
|
||||||
GetBorderAndPadding(borderPadding);
|
GetBorderAndPadding(borderPadding);
|
||||||
|
@ -302,16 +293,6 @@ nsIFrame::GetClientRect(nsRect& aClientRect)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsIFrame::GetContentRect(nsRect& aContentRect)
|
|
||||||
{
|
|
||||||
aContentRect = mRect;
|
|
||||||
aContentRect.x = 0;
|
|
||||||
aContentRect.y = 0;
|
|
||||||
NS_BOX_ASSERTION(this, aContentRect.width >=0 && aContentRect.height >= 0, "Content Size < 0");
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsBox::SetBounds(nsBoxLayoutState& aState, const nsRect& aRect, PRBool aRemoveOverflowArea)
|
nsBox::SetBounds(nsBoxLayoutState& aState, const nsRect& aRect, PRBool aRemoveOverflowArea)
|
||||||
{
|
{
|
||||||
|
@ -523,9 +504,7 @@ nsBox::GetPrefSize(nsBoxLayoutState& aState)
|
||||||
nsSize pref(0,0);
|
nsSize pref(0,0);
|
||||||
DISPLAY_PREF_SIZE(this, pref);
|
DISPLAY_PREF_SIZE(this, pref);
|
||||||
|
|
||||||
PRBool collapsed = PR_FALSE;
|
if (IsCollapsed(aState))
|
||||||
IsCollapsed(aState, collapsed);
|
|
||||||
if (collapsed)
|
|
||||||
return pref;
|
return pref;
|
||||||
|
|
||||||
AddBorderAndPadding(pref);
|
AddBorderAndPadding(pref);
|
||||||
|
@ -545,9 +524,7 @@ nsBox::GetMinSize(nsBoxLayoutState& aState)
|
||||||
nsSize min(0,0);
|
nsSize min(0,0);
|
||||||
DISPLAY_MIN_SIZE(this, min);
|
DISPLAY_MIN_SIZE(this, min);
|
||||||
|
|
||||||
PRBool collapsed = PR_FALSE;
|
if (IsCollapsed(aState))
|
||||||
IsCollapsed(aState, collapsed);
|
|
||||||
if (collapsed)
|
|
||||||
return min;
|
return min;
|
||||||
|
|
||||||
AddBorderAndPadding(min);
|
AddBorderAndPadding(min);
|
||||||
|
@ -568,9 +545,7 @@ nsBox::GetMaxSize(nsBoxLayoutState& aState)
|
||||||
nsSize max(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
nsSize max(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
||||||
DISPLAY_MAX_SIZE(this, max);
|
DISPLAY_MAX_SIZE(this, max);
|
||||||
|
|
||||||
PRBool collapsed = PR_FALSE;
|
if (IsCollapsed(aState))
|
||||||
IsCollapsed(aState, collapsed);
|
|
||||||
if (collapsed)
|
|
||||||
return max;
|
return max;
|
||||||
|
|
||||||
AddBorderAndPadding(max);
|
AddBorderAndPadding(max);
|
||||||
|
@ -579,46 +554,42 @@ nsBox::GetMaxSize(nsBoxLayoutState& aState)
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nscoord
|
||||||
nsBox::GetFlex(nsBoxLayoutState& aState, nscoord& aFlex)
|
nsBox::GetFlex(nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
aFlex = 0;
|
nscoord flex = 0;
|
||||||
|
|
||||||
GetDefaultFlex(aFlex);
|
GetDefaultFlex(flex);
|
||||||
nsIBox::AddCSSFlex(aState, this, aFlex);
|
nsIBox::AddCSSFlex(aState, this, flex);
|
||||||
|
|
||||||
return NS_OK;
|
return flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
PRUint32
|
||||||
nsIFrame::GetOrdinal(nsBoxLayoutState& aState, PRUint32& aOrdinal)
|
nsIFrame::GetOrdinal(nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
aOrdinal = DEFAULT_ORDINAL_GROUP;
|
PRUint32 ordinal = DEFAULT_ORDINAL_GROUP;
|
||||||
nsIBox::AddCSSOrdinal(aState, this, aOrdinal);
|
nsIBox::AddCSSOrdinal(aState, this, ordinal);
|
||||||
|
|
||||||
return NS_OK;
|
return ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nscoord
|
||||||
nsBox::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent)
|
nsBox::GetBoxAscent(nsBoxLayoutState& aState)
|
||||||
|
{
|
||||||
|
if (IsCollapsed(aState))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return GetPrefSize(aState).height;
|
||||||
|
}
|
||||||
|
|
||||||
|
PRBool
|
||||||
|
nsBox::IsCollapsed(nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
aAscent = 0;
|
|
||||||
PRBool collapsed = PR_FALSE;
|
PRBool collapsed = PR_FALSE;
|
||||||
IsCollapsed(aState, collapsed);
|
nsIBox::AddCSSCollapsed(aState, this, collapsed);
|
||||||
if (collapsed)
|
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
aAscent = GetPrefSize(aState).height;
|
return collapsed;
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsBox::IsCollapsed(nsBoxLayoutState& aState, PRBool& aCollapsed)
|
|
||||||
{
|
|
||||||
aCollapsed = PR_FALSE;
|
|
||||||
nsIBox::AddCSSCollapsed(aState, this, aCollapsed);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -1168,14 +1139,13 @@ nsBox::GetInset(nsMargin& margin)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRBool
|
||||||
nsBox::GetMouseThrough(PRBool& aMouseThrough)
|
nsBox::GetMouseThrough() const
|
||||||
{
|
{
|
||||||
if (mParent && mParent->IsBoxFrame())
|
if (mParent && mParent->IsBoxFrame())
|
||||||
return mParent->GetMouseThrough(aMouseThrough);
|
return mParent->GetMouseThrough();
|
||||||
|
|
||||||
aMouseThrough = PR_FALSE;
|
return PR_FALSE;
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
|
@ -1184,11 +1154,3 @@ nsBox::GetDefaultFlex(PRInt32& aFlex)
|
||||||
aFlex = 0;
|
aFlex = 0;
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsBox::GetIndexOf(nsIBox* aChild, PRInt32* aIndex)
|
|
||||||
{
|
|
||||||
// return -1. We have no children
|
|
||||||
*aIndex = -1;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
|
@ -60,12 +60,12 @@ public:
|
||||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
||||||
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
||||||
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
||||||
NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex);
|
virtual nscoord GetFlex(nsBoxLayoutState& aBoxLayoutState);
|
||||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
|
virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState);
|
||||||
|
|
||||||
virtual nsSize GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState);
|
virtual nsSize GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState);
|
||||||
|
|
||||||
NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed);
|
virtual PRBool IsCollapsed(nsBoxLayoutState& aBoxLayoutState);
|
||||||
|
|
||||||
NS_IMETHOD SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect,
|
NS_IMETHOD SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect,
|
||||||
PRBool aRemoveOverflowArea = PR_FALSE);
|
PRBool aRemoveOverflowArea = PR_FALSE);
|
||||||
|
@ -83,7 +83,7 @@ public:
|
||||||
|
|
||||||
NS_IMETHOD RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild);
|
NS_IMETHOD RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild);
|
||||||
|
|
||||||
NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough);
|
virtual PRBool GetMouseThrough() const;
|
||||||
|
|
||||||
#ifdef DEBUG_LAYOUT
|
#ifdef DEBUG_LAYOUT
|
||||||
NS_IMETHOD GetInset(nsMargin& aInset);
|
NS_IMETHOD GetInset(nsMargin& aInset);
|
||||||
|
@ -94,8 +94,6 @@ public:
|
||||||
NS_IMETHOD DumpBox(FILE* out);
|
NS_IMETHOD DumpBox(FILE* out);
|
||||||
NS_HIDDEN_(void) PropagateDebug(nsBoxLayoutState& aState);
|
NS_HIDDEN_(void) PropagateDebug(nsBoxLayoutState& aState);
|
||||||
#endif
|
#endif
|
||||||
NS_IMETHOD ChildrenMustHaveWidgets(PRBool& aMust) const;
|
|
||||||
NS_IMETHOD GetIndexOf(nsIBox* aChild, PRInt32* aIndex);
|
|
||||||
|
|
||||||
nsBox();
|
nsBox();
|
||||||
virtual ~nsBox();
|
virtual ~nsBox();
|
||||||
|
|
|
@ -220,9 +220,7 @@ nsBoxFrame::Init(nsIContent* aContent,
|
||||||
|
|
||||||
// see if we need a widget
|
// see if we need a widget
|
||||||
if (aParent && aParent->IsBoxFrame()) {
|
if (aParent && aParent->IsBoxFrame()) {
|
||||||
PRBool needsWidget = PR_FALSE;
|
if (aParent->ChildrenMustHaveWidgets()) {
|
||||||
aParent->ChildrenMustHaveWidgets(needsWidget);
|
|
||||||
if (needsWidget) {
|
|
||||||
nsHTMLContainerFrame::CreateViewForFrame(this, nsnull, PR_TRUE);
|
nsHTMLContainerFrame::CreateViewForFrame(this, nsnull, PR_TRUE);
|
||||||
|
|
||||||
nsIView* view = GetView();
|
nsIView* view = GetView();
|
||||||
|
@ -263,29 +261,21 @@ void nsBoxFrame::UpdateMouseThrough()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRBool
|
||||||
nsBoxFrame::GetMouseThrough(PRBool& aMouseThrough)
|
nsBoxFrame::GetMouseThrough() const
|
||||||
{
|
{
|
||||||
switch(mMouseThrough)
|
switch(mMouseThrough)
|
||||||
{
|
{
|
||||||
case always:
|
case always:
|
||||||
aMouseThrough = PR_TRUE;
|
return PR_TRUE;
|
||||||
return NS_OK;
|
|
||||||
case never:
|
case never:
|
||||||
aMouseThrough = PR_FALSE;
|
return PR_FALSE;
|
||||||
return NS_OK;
|
|
||||||
case unset:
|
case unset:
|
||||||
{
|
|
||||||
if (mParent && mParent->IsBoxFrame())
|
if (mParent && mParent->IsBoxFrame())
|
||||||
return mParent->GetMouseThrough(aMouseThrough);
|
return mParent->GetMouseThrough();
|
||||||
else {
|
|
||||||
aMouseThrough = PR_FALSE;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_ERROR_FAILURE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -793,7 +783,7 @@ nsBoxFrame::Reflow(nsPresContext* aPresContext,
|
||||||
// getting the ascent could be a lot of work. Don't get it if
|
// getting the ascent could be a lot of work. Don't get it if
|
||||||
// we are the root. The viewport doesn't care about it.
|
// we are the root. The viewport doesn't care about it.
|
||||||
if (!(mState & NS_STATE_IS_ROOT)) {
|
if (!(mState & NS_STATE_IS_ROOT)) {
|
||||||
GetAscent(state, ascent);
|
ascent = GetBoxAscent(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
aDesiredSize.width = mRect.width;
|
aDesiredSize.width = mRect.width;
|
||||||
|
@ -840,9 +830,7 @@ nsBoxFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState)
|
||||||
PropagateDebug(aBoxLayoutState);
|
PropagateDebug(aBoxLayoutState);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PRBool collapsed = PR_FALSE;
|
if (IsCollapsed(aBoxLayoutState))
|
||||||
IsCollapsed(aBoxLayoutState, collapsed);
|
|
||||||
if (collapsed)
|
|
||||||
return size;
|
return size;
|
||||||
|
|
||||||
// if the size was not completely redefined in CSS then ask our children
|
// if the size was not completely redefined in CSS then ask our children
|
||||||
|
@ -863,34 +851,25 @@ nsBoxFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState)
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nscoord
|
||||||
nsBoxFrame::GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent)
|
nsBoxFrame::GetBoxAscent(nsBoxLayoutState& aBoxLayoutState)
|
||||||
{
|
{
|
||||||
if (!DoesNeedRecalc(mAscent)) {
|
if (!DoesNeedRecalc(mAscent))
|
||||||
aAscent = mAscent;
|
return mAscent;
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG_LAYOUT
|
#ifdef DEBUG_LAYOUT
|
||||||
PropagateDebug(aBoxLayoutState);
|
PropagateDebug(aBoxLayoutState);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
if (IsCollapsed(aBoxLayoutState))
|
||||||
aAscent = 0;
|
return 0;
|
||||||
|
|
||||||
PRBool collapsed = PR_FALSE;
|
|
||||||
IsCollapsed(aBoxLayoutState, collapsed);
|
|
||||||
if (collapsed)
|
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
if (mLayoutManager)
|
if (mLayoutManager)
|
||||||
rv = mLayoutManager->GetAscent(this, aBoxLayoutState, aAscent);
|
mLayoutManager->GetAscent(this, aBoxLayoutState, mAscent);
|
||||||
else
|
else
|
||||||
rv = nsBox::GetAscent(aBoxLayoutState, aAscent);
|
mAscent = nsBox::GetBoxAscent(aBoxLayoutState);
|
||||||
|
|
||||||
mAscent = aAscent;
|
return mAscent;
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSize
|
nsSize
|
||||||
|
@ -907,9 +886,7 @@ nsBoxFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState)
|
||||||
PropagateDebug(aBoxLayoutState);
|
PropagateDebug(aBoxLayoutState);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PRBool collapsed = PR_FALSE;
|
if (IsCollapsed(aBoxLayoutState))
|
||||||
IsCollapsed(aBoxLayoutState, collapsed);
|
|
||||||
if (collapsed)
|
|
||||||
return size;
|
return size;
|
||||||
|
|
||||||
// if the size was not completely redefined in CSS then ask our children
|
// if the size was not completely redefined in CSS then ask our children
|
||||||
|
@ -942,9 +919,7 @@ nsBoxFrame::GetMaxSize(nsBoxLayoutState& aBoxLayoutState)
|
||||||
PropagateDebug(aBoxLayoutState);
|
PropagateDebug(aBoxLayoutState);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PRBool collapsed = PR_FALSE;
|
if (IsCollapsed(aBoxLayoutState))
|
||||||
IsCollapsed(aBoxLayoutState, collapsed);
|
|
||||||
if (collapsed)
|
|
||||||
return size;
|
return size;
|
||||||
|
|
||||||
// if the size was not completely redefined in CSS then ask our children
|
// if the size was not completely redefined in CSS then ask our children
|
||||||
|
@ -963,21 +938,15 @@ nsBoxFrame::GetMaxSize(nsBoxLayoutState& aBoxLayoutState)
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nscoord
|
||||||
nsBoxFrame::GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex)
|
nsBoxFrame::GetFlex(nsBoxLayoutState& aBoxLayoutState)
|
||||||
{
|
{
|
||||||
if (!DoesNeedRecalc(mFlex)) {
|
if (!DoesNeedRecalc(mFlex))
|
||||||
aFlex = mFlex;
|
return mFlex;
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
mFlex = nsBox::GetFlex(aBoxLayoutState);
|
||||||
|
|
||||||
mFlex = 0;
|
return mFlex;
|
||||||
rv = nsBox::GetFlex(aBoxLayoutState, mFlex);
|
|
||||||
aFlex = mFlex;
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1394,8 +1363,6 @@ nsBoxFrame::PaintXULDebugBackground(nsIRenderingContext& aRenderingContext,
|
||||||
nsPoint aPt)
|
nsPoint aPt)
|
||||||
{
|
{
|
||||||
nsMargin border;
|
nsMargin border;
|
||||||
nsRect inner;
|
|
||||||
|
|
||||||
GetBorder(border);
|
GetBorder(border);
|
||||||
|
|
||||||
nsMargin debugBorder;
|
nsMargin debugBorder;
|
||||||
|
@ -1413,8 +1380,8 @@ nsBoxFrame::PaintXULDebugBackground(nsIRenderingContext& aRenderingContext,
|
||||||
GetDebugPadding(debugPadding);
|
GetDebugPadding(debugPadding);
|
||||||
PixelMarginToTwips(GetPresContext(), debugPadding);
|
PixelMarginToTwips(GetPresContext(), debugPadding);
|
||||||
|
|
||||||
GetContentRect(inner);
|
nsRect inner(mRect);
|
||||||
inner += aPt;
|
inner.MoveTo(aPt);
|
||||||
inner.Deflate(debugMargin);
|
inner.Deflate(debugMargin);
|
||||||
inner.Deflate(border);
|
inner.Deflate(border);
|
||||||
//nsRect borderRect(inner);
|
//nsRect borderRect(inner);
|
||||||
|
@ -1471,14 +1438,12 @@ nsBoxFrame::PaintXULDebugOverlay(nsIRenderingContext& aRenderingContext,
|
||||||
GetDebugMargin(debugMargin);
|
GetDebugMargin(debugMargin);
|
||||||
PixelMarginToTwips(GetPresContext(), debugMargin);
|
PixelMarginToTwips(GetPresContext(), debugMargin);
|
||||||
|
|
||||||
nsRect inner;
|
nsRect inner(mRect);
|
||||||
GetContentRect(inner);
|
inner.MoveTo(aPt);
|
||||||
inner += aPt;
|
|
||||||
inner.Deflate(debugMargin);
|
inner.Deflate(debugMargin);
|
||||||
inner.Deflate(border);
|
inner.Deflate(border);
|
||||||
|
|
||||||
nscoord onePixel = GetPresContext()->IntScaledPixelsToTwips(1);
|
nscoord onePixel = GetPresContext()->IntScaledPixelsToTwips(1);
|
||||||
GetContentRect(r);
|
|
||||||
|
|
||||||
GetChildBox(&kid);
|
GetChildBox(&kid);
|
||||||
while (nsnull != kid) {
|
while (nsnull != kid) {
|
||||||
|
@ -1505,14 +1470,9 @@ nsBoxFrame::PaintXULDebugOverlay(nsIRenderingContext& aRenderingContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsBoxLayoutState state(GetPresContext());
|
nsBoxLayoutState state(GetPresContext());
|
||||||
nscoord flex = 0;
|
nscoord flex = kid->GetFlex(state);
|
||||||
kid->GetFlex(state, flex);
|
|
||||||
|
|
||||||
|
if (!kid->IsCollapsed(state)) {
|
||||||
PRBool isCollapsed = PR_FALSE;
|
|
||||||
kid->IsCollapsed(state, isCollapsed);
|
|
||||||
|
|
||||||
if (!isCollapsed) {
|
|
||||||
aRenderingContext.SetColor(NS_RGB(255,255,255));
|
aRenderingContext.SetColor(NS_RGB(255,255,255));
|
||||||
|
|
||||||
if (isHorizontal)
|
if (isHorizontal)
|
||||||
|
@ -1801,8 +1761,8 @@ nsBoxFrame::DisplayDebugInfoFor(nsIBox* aBox,
|
||||||
nscoord y = aPoint.y;
|
nscoord y = aPoint.y;
|
||||||
|
|
||||||
// get the area inside our border but not our debug margins.
|
// get the area inside our border but not our debug margins.
|
||||||
nsRect insideBorder;
|
nsRect insideBorder(aBox->mRect);
|
||||||
aBox->GetContentRect(insideBorder);
|
insideBorder.MoveTo(0,0):
|
||||||
nsMargin border(0,0,0,0);
|
nsMargin border(0,0,0,0);
|
||||||
aBox->GetBorderAndPadding(border);
|
aBox->GetBorderAndPadding(border);
|
||||||
insideBorder.Deflate(border);
|
insideBorder.Deflate(border);
|
||||||
|
@ -1862,10 +1822,6 @@ nsBoxFrame::DisplayDebugInfoFor(nsIBox* aBox,
|
||||||
nsSize maxSizeCSS (NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
nsSize maxSizeCSS (NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
||||||
nscoord flexCSS = NS_INTRINSICSIZE;
|
nscoord flexCSS = NS_INTRINSICSIZE;
|
||||||
|
|
||||||
nscoord flexSize = 0;
|
|
||||||
nscoord ascentSize = 0;
|
|
||||||
|
|
||||||
|
|
||||||
nsIBox::AddCSSPrefSize(state, child, prefSizeCSS);
|
nsIBox::AddCSSPrefSize(state, child, prefSizeCSS);
|
||||||
nsIBox::AddCSSMinSize (state, child, minSizeCSS);
|
nsIBox::AddCSSMinSize (state, child, minSizeCSS);
|
||||||
nsIBox::AddCSSMaxSize (state, child, maxSizeCSS);
|
nsIBox::AddCSSMaxSize (state, child, maxSizeCSS);
|
||||||
|
@ -1874,8 +1830,8 @@ nsBoxFrame::DisplayDebugInfoFor(nsIBox* aBox,
|
||||||
nsSize prefSize = child->GetPrefSize(state);
|
nsSize prefSize = child->GetPrefSize(state);
|
||||||
nsSize minSize = child->GetMinSize(state);
|
nsSize minSize = child->GetMinSize(state);
|
||||||
nsSize maxSize = child->GetMaxSize(state);
|
nsSize maxSize = child->GetMaxSize(state);
|
||||||
child->GetFlex(state, flexSize);
|
nscoord flexSize = child->GetFlex(state);
|
||||||
child->GetAscent(state, ascentSize);
|
nscoord ascentSize = child->GetBoxAscent(state);
|
||||||
|
|
||||||
char min[100];
|
char min[100];
|
||||||
char pref[100];
|
char pref[100];
|
||||||
|
@ -2159,8 +2115,7 @@ nsBoxFrame::CheckBoxOrder(nsBoxLayoutState& aState)
|
||||||
while (child) {
|
while (child) {
|
||||||
++childCount;
|
++childCount;
|
||||||
|
|
||||||
PRUint32 ordinal;
|
PRUint32 ordinal = child->GetOrdinal(aState);
|
||||||
child->GetOrdinal(aState, ordinal);
|
|
||||||
if (ordinal != DEFAULT_ORDINAL_GROUP)
|
if (ordinal != DEFAULT_ORDINAL_GROUP)
|
||||||
orderBoxes = PR_TRUE;
|
orderBoxes = PR_TRUE;
|
||||||
|
|
||||||
|
@ -2185,9 +2140,9 @@ nsBoxFrame::CheckBoxOrder(nsBoxLayoutState& aState)
|
||||||
PRUint32 minOrd, jOrd;
|
PRUint32 minOrd, jOrd;
|
||||||
for(i = 0; i < childCount; i++) {
|
for(i = 0; i < childCount; i++) {
|
||||||
min = i;
|
min = i;
|
||||||
boxes[min]->GetOrdinal(aState, minOrd);
|
minOrd = boxes[min]->GetOrdinal(aState);
|
||||||
for(j = i + 1; j < childCount; j++) {
|
for(j = i + 1; j < childCount; j++) {
|
||||||
boxes[j]->GetOrdinal(aState, jOrd);
|
jOrd = boxes[j]->GetOrdinal(aState);
|
||||||
if (jOrd < minOrd) {
|
if (jOrd < minOrd) {
|
||||||
min = j;
|
min = j;
|
||||||
minOrd = jOrd;
|
minOrd = jOrd;
|
||||||
|
@ -2241,8 +2196,7 @@ nsBoxFrame::LayoutChildAt(nsBoxLayoutState& aState, nsIBox* aBox, const nsRect&
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsBoxFrame::RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild)
|
nsBoxFrame::RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild)
|
||||||
{
|
{
|
||||||
PRUint32 ord;
|
PRUint32 ord = aChild->GetOrdinal(aState);
|
||||||
aChild->GetOrdinal(aState, ord);
|
|
||||||
|
|
||||||
nsIFrame *child = mFrames.FirstChild();
|
nsIFrame *child = mFrames.FirstChild();
|
||||||
nsIFrame *curPrevSib = nsnull, *newPrevSib = nsnull;
|
nsIFrame *curPrevSib = nsnull, *newPrevSib = nsnull;
|
||||||
|
@ -2254,8 +2208,7 @@ nsBoxFrame::RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild)
|
||||||
else if (!foundPrevSib)
|
else if (!foundPrevSib)
|
||||||
curPrevSib = child;
|
curPrevSib = child;
|
||||||
|
|
||||||
PRUint32 ordCmp;
|
PRUint32 ordCmp = child->GetOrdinal(aState);
|
||||||
child->GetOrdinal(aState, ordCmp);
|
|
||||||
if (ord < ordCmp)
|
if (ord < ordCmp)
|
||||||
foundNewPrevSib = PR_TRUE;
|
foundNewPrevSib = PR_TRUE;
|
||||||
else if (!foundNewPrevSib && child != aChild)
|
else if (!foundNewPrevSib && child != aChild)
|
||||||
|
@ -2293,27 +2246,6 @@ nsBoxFrame::RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsBoxFrame::GetIndexOf(nsIBox* aBox, PRInt32* aIndex)
|
|
||||||
{
|
|
||||||
nsIBox* child = mFrames.FirstChild();
|
|
||||||
PRInt32 count = 0;
|
|
||||||
while (child)
|
|
||||||
{
|
|
||||||
if (aBox == child) {
|
|
||||||
*aIndex = count;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
child->GetNextBox(&child);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
*aIndex = -1;
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
nsBoxFrame::GetWasCollapsed(nsBoxLayoutState& aState)
|
nsBoxFrame::GetWasCollapsed(nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
|
|
|
@ -98,13 +98,12 @@ public:
|
||||||
NS_IMETHOD SetLayoutManager(nsIBoxLayout* aLayout);
|
NS_IMETHOD SetLayoutManager(nsIBoxLayout* aLayout);
|
||||||
NS_IMETHOD GetLayoutManager(nsIBoxLayout** aLayout);
|
NS_IMETHOD GetLayoutManager(nsIBoxLayout** aLayout);
|
||||||
NS_IMETHOD RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild);
|
NS_IMETHOD RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild);
|
||||||
NS_IMETHOD GetIndexOf(nsIBox* aChild, PRInt32* aIndex);
|
|
||||||
|
|
||||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
||||||
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
||||||
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
||||||
NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex);
|
virtual nscoord GetFlex(nsBoxLayoutState& aBoxLayoutState);
|
||||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
|
virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState);
|
||||||
#ifdef DEBUG_LAYOUT
|
#ifdef DEBUG_LAYOUT
|
||||||
NS_IMETHOD SetDebug(nsBoxLayoutState& aBoxLayoutState, PRBool aDebug);
|
NS_IMETHOD SetDebug(nsBoxLayoutState& aBoxLayoutState, PRBool aDebug);
|
||||||
NS_IMETHOD GetDebug(PRBool& aDebug);
|
NS_IMETHOD GetDebug(PRBool& aDebug);
|
||||||
|
@ -115,7 +114,7 @@ public:
|
||||||
NS_IMETHOD GetHAlign(Halignment& aAlign);
|
NS_IMETHOD GetHAlign(Halignment& aAlign);
|
||||||
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
||||||
|
|
||||||
NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough);
|
virtual PRBool GetMouseThrough() const;
|
||||||
virtual PRBool ComputesOwnOverflowArea() { return PR_FALSE; }
|
virtual PRBool ComputesOwnOverflowArea() { return PR_FALSE; }
|
||||||
|
|
||||||
// ----- child and sibling operations ---
|
// ----- child and sibling operations ---
|
||||||
|
|
|
@ -99,14 +99,16 @@ nsBoxLayout::AddInset(nsIBox* aBox, nsSize& aSize)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsBoxLayout::GetFlex(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aFlex)
|
nsBoxLayout::GetFlex(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aFlex)
|
||||||
{
|
{
|
||||||
return aBox->GetFlex(aState, aFlex);
|
aFlex = aBox->GetFlex(aState);
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsBoxLayout::IsCollapsed(nsIBox* aBox, nsBoxLayoutState& aState, PRBool& aCollapsed)
|
nsBoxLayout::IsCollapsed(nsIBox* aBox, nsBoxLayoutState& aState, PRBool& aCollapsed)
|
||||||
{
|
{
|
||||||
return aBox->IsCollapsed(aState, aCollapsed);
|
aCollapsed = aBox->IsCollapsed(aState);
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -63,13 +63,6 @@ NS_NewButtonBoxFrame (nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||||
return new (aPresShell) nsButtonBoxFrame(aPresShell, aContext);
|
return new (aPresShell) nsButtonBoxFrame(aPresShell, aContext);
|
||||||
} // NS_NewXULButtonFrame
|
} // NS_NewXULButtonFrame
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsButtonBoxFrame::GetMouseThrough(PRBool& aMouseThrough)
|
|
||||||
{
|
|
||||||
aMouseThrough = PR_FALSE;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsButtonBoxFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
|
nsButtonBoxFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
|
||||||
const nsRect& aDirtyRect,
|
const nsRect& aDirtyRect,
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
nsGUIEvent* aEvent,
|
nsGUIEvent* aEvent,
|
||||||
nsEventStatus* aEventStatus);
|
nsEventStatus* aEventStatus);
|
||||||
|
|
||||||
NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough);
|
virtual PRBool GetMouseThrough() const { return PR_FALSE; }
|
||||||
|
|
||||||
virtual void MouseClicked (nsPresContext* aPresContext, nsGUIEvent* aEvent)
|
virtual void MouseClicked (nsPresContext* aPresContext, nsGUIEvent* aEvent)
|
||||||
{ DoMouseClick(aEvent, PR_FALSE); }
|
{ DoMouseClick(aEvent, PR_FALSE); }
|
||||||
|
|
|
@ -80,16 +80,6 @@ nsDeckFrame::nsDeckFrame(nsIPresShell* aPresShell,
|
||||||
SetLayoutManager(layout);
|
SetLayoutManager(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hack for deck who requires that all its children has widgets
|
|
||||||
*/
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDeckFrame::ChildrenMustHaveWidgets(PRBool& aMust) const
|
|
||||||
{
|
|
||||||
aMust = PR_TRUE;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDeckFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
nsDeckFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
||||||
nsIAtom* aAttribute,
|
nsIAtom* aAttribute,
|
||||||
|
|
|
@ -74,7 +74,7 @@ public:
|
||||||
nsIFrame* aParent,
|
nsIFrame* aParent,
|
||||||
nsIFrame* aPrevInFlow);
|
nsIFrame* aPrevInFlow);
|
||||||
|
|
||||||
NS_IMETHOD ChildrenMustHaveWidgets(PRBool& aMust) const;
|
virtual PRBool ChildrenMustHaveWidgets() const { return PR_TRUE; }
|
||||||
|
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
||||||
|
|
|
@ -100,9 +100,7 @@ nsLeafBoxFrame::Init(
|
||||||
|
|
||||||
// see if we need a widget
|
// see if we need a widget
|
||||||
if (aParent && aParent->IsBoxFrame()) {
|
if (aParent && aParent->IsBoxFrame()) {
|
||||||
PRBool needsWidget = PR_FALSE;
|
if (aParent->ChildrenMustHaveWidgets()) {
|
||||||
aParent->ChildrenMustHaveWidgets(needsWidget);
|
|
||||||
if (needsWidget) {
|
|
||||||
nsHTMLContainerFrame::CreateViewForFrame(this, nsnull, PR_TRUE);
|
nsHTMLContainerFrame::CreateViewForFrame(this, nsnull, PR_TRUE);
|
||||||
nsIView* view = GetView();
|
nsIView* view = GetView();
|
||||||
|
|
||||||
|
@ -146,29 +144,21 @@ void nsLeafBoxFrame::UpdateMouseThrough()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRBool
|
||||||
nsLeafBoxFrame::GetMouseThrough(PRBool& aMouseThrough)
|
nsLeafBoxFrame::GetMouseThrough() const
|
||||||
{
|
{
|
||||||
switch (mMouseThrough)
|
switch (mMouseThrough)
|
||||||
{
|
{
|
||||||
case always:
|
case always:
|
||||||
aMouseThrough = PR_TRUE;
|
return PR_TRUE;
|
||||||
return NS_OK;
|
|
||||||
case never:
|
case never:
|
||||||
aMouseThrough = PR_FALSE;
|
return PR_FALSE;
|
||||||
return NS_OK;
|
|
||||||
case unset:
|
case unset:
|
||||||
{
|
|
||||||
if (mParent && mParent->IsBoxFrame())
|
if (mParent && mParent->IsBoxFrame())
|
||||||
return mParent->GetMouseThrough(aMouseThrough);
|
return mParent->GetMouseThrough();
|
||||||
else {
|
|
||||||
aMouseThrough = PR_FALSE;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_ERROR_FAILURE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -344,14 +334,9 @@ nsLeafBoxFrame::Reflow(nsPresContext* aPresContext,
|
||||||
Layout(state);
|
Layout(state);
|
||||||
|
|
||||||
// ok our child could have gotten bigger. So lets get its bounds
|
// ok our child could have gotten bigger. So lets get its bounds
|
||||||
|
|
||||||
// get the ascent
|
|
||||||
nscoord ascent = mRect.height;
|
|
||||||
GetAscent(state, ascent);
|
|
||||||
|
|
||||||
aDesiredSize.width = mRect.width;
|
aDesiredSize.width = mRect.width;
|
||||||
aDesiredSize.height = mRect.height;
|
aDesiredSize.height = mRect.height;
|
||||||
aDesiredSize.ascent = ascent;
|
aDesiredSize.ascent = GetBoxAscent(state);
|
||||||
|
|
||||||
// NS_FRAME_OUTSIDE_CHILDREN is set in SetBounds() above
|
// NS_FRAME_OUTSIDE_CHILDREN is set in SetBounds() above
|
||||||
if (mState & NS_FRAME_OUTSIDE_CHILDREN) {
|
if (mState & NS_FRAME_OUTSIDE_CHILDREN) {
|
||||||
|
@ -432,16 +417,16 @@ nsLeafBoxFrame::GetMaxSize(nsBoxLayoutState& aState)
|
||||||
return nsBox::GetMaxSize(aState);
|
return nsBox::GetMaxSize(aState);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
/* virtual */ nscoord
|
||||||
nsLeafBoxFrame::GetFlex(nsBoxLayoutState& aState, nscoord& aFlex)
|
nsLeafBoxFrame::GetFlex(nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
return nsBox::GetFlex(aState, aFlex);
|
return nsBox::GetFlex(aState);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
/* virtual */ nscoord
|
||||||
nsLeafBoxFrame::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent)
|
nsLeafBoxFrame::GetBoxAscent(nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
return nsBox::GetAscent(aState, aAscent);
|
return nsBox::GetBoxAscent(aState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */ void
|
/* virtual */ void
|
||||||
|
|
|
@ -55,8 +55,8 @@ public:
|
||||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aState);
|
virtual nsSize GetPrefSize(nsBoxLayoutState& aState);
|
||||||
virtual nsSize GetMinSize(nsBoxLayoutState& aState);
|
virtual nsSize GetMinSize(nsBoxLayoutState& aState);
|
||||||
virtual nsSize GetMaxSize(nsBoxLayoutState& aState);
|
virtual nsSize GetMaxSize(nsBoxLayoutState& aState);
|
||||||
NS_IMETHOD GetFlex(nsBoxLayoutState& aState, nscoord& aFlex);
|
virtual nscoord GetFlex(nsBoxLayoutState& aState);
|
||||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aState, nscoord& aAscent);
|
virtual nscoord GetBoxAscent(nsBoxLayoutState& aState);
|
||||||
|
|
||||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -91,7 +91,7 @@ public:
|
||||||
nsIAtom* aAttribute,
|
nsIAtom* aAttribute,
|
||||||
PRInt32 aModType);
|
PRInt32 aModType);
|
||||||
|
|
||||||
NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough);
|
virtual PRBool GetMouseThrough() const;
|
||||||
virtual PRBool ComputesOwnOverflowArea() { return PR_FALSE; }
|
virtual PRBool ComputesOwnOverflowArea() { return PR_FALSE; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -1031,9 +1031,6 @@ nsMenuFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMenuFrame::DoLayout(nsBoxLayoutState& aState)
|
nsMenuFrame::DoLayout(nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
nsRect contentRect;
|
|
||||||
GetContentRect(contentRect);
|
|
||||||
|
|
||||||
// lay us out
|
// lay us out
|
||||||
nsresult rv = nsBoxFrame::DoLayout(aState);
|
nsresult rv = nsBoxFrame::DoLayout(aState);
|
||||||
|
|
||||||
|
@ -1053,7 +1050,7 @@ nsMenuFrame::DoLayout(nsBoxLayoutState& aState)
|
||||||
BoundsCheck(minSize, prefSize, maxSize);
|
BoundsCheck(minSize, prefSize, maxSize);
|
||||||
|
|
||||||
if (sizeToPopup)
|
if (sizeToPopup)
|
||||||
prefSize.width = contentRect.width;
|
prefSize.width = mRect.width;
|
||||||
|
|
||||||
// if the pref size changed then set bounds to be the pref size
|
// if the pref size changed then set bounds to be the pref size
|
||||||
// and sync the view. And set new pref size.
|
// and sync the view. And set new pref size.
|
||||||
|
@ -1952,10 +1949,8 @@ public:
|
||||||
NS_IMETHOD Run() {
|
NS_IMETHOD Run() {
|
||||||
nsIFrame* frame = mWeakFrame.GetFrame();
|
nsIFrame* frame = mWeakFrame.GetFrame();
|
||||||
if (frame) {
|
if (frame) {
|
||||||
PRBool collapsed = PR_FALSE;
|
|
||||||
nsBoxLayoutState state(frame->GetPresContext());
|
nsBoxLayoutState state(frame->GetPresContext());
|
||||||
frame->IsCollapsed(state, collapsed);
|
if (!frame->IsCollapsed(state)) {
|
||||||
if (!collapsed) {
|
|
||||||
nsIMenuFrame* imenu = nsnull;
|
nsIMenuFrame* imenu = nsnull;
|
||||||
CallQueryInterface(frame, &imenu);
|
CallQueryInterface(frame, &imenu);
|
||||||
if (imenu) {
|
if (imenu) {
|
||||||
|
@ -1976,14 +1971,10 @@ public:
|
||||||
PRBool
|
PRBool
|
||||||
nsMenuFrame::SizeToPopup(nsBoxLayoutState& aState, nsSize& aSize)
|
nsMenuFrame::SizeToPopup(nsBoxLayoutState& aState, nsSize& aSize)
|
||||||
{
|
{
|
||||||
PRBool collapsed = PR_FALSE;
|
if (!IsCollapsed(aState)) {
|
||||||
IsCollapsed(aState, collapsed);
|
|
||||||
if (!collapsed) {
|
|
||||||
nsSize tmpSize(-1, 0);
|
nsSize tmpSize(-1, 0);
|
||||||
nsIBox::AddCSSPrefSize(aState, this, tmpSize);
|
nsIBox::AddCSSPrefSize(aState, this, tmpSize);
|
||||||
nscoord flex;
|
if (tmpSize.width == -1 && GetFlex(aState) == 0) {
|
||||||
GetFlex(aState, flex);
|
|
||||||
if (tmpSize.width == -1 && flex == 0) {
|
|
||||||
nsIFrame* frame = mPopupFrames.FirstChild();
|
nsIFrame* frame = mPopupFrames.FirstChild();
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
nsCOMPtr<nsIContent> child;
|
nsCOMPtr<nsIContent> child;
|
||||||
|
|
|
@ -163,8 +163,7 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollByIndex(PRInt32 dindexes)
|
||||||
// now get the scrolled boxes first child.
|
// now get the scrolled boxes first child.
|
||||||
scrolledBox->GetChildBox(&child);
|
scrolledBox->GetChildBox(&child);
|
||||||
|
|
||||||
PRBool horiz = PR_FALSE;
|
PRBool horiz = scrolledBox->IsHorizontal();
|
||||||
scrolledBox->GetOrientation(horiz);
|
|
||||||
nsPoint cp;
|
nsPoint cp;
|
||||||
scrollableView->GetScrollPosition(cp.x,cp.y);
|
scrollableView->GetScrollPosition(cp.x,cp.y);
|
||||||
nscoord diff = 0;
|
nscoord diff = 0;
|
||||||
|
@ -303,8 +302,6 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollToElement(nsIDOMElement *child)
|
||||||
// TODO: make sure the child is inside the box
|
// TODO: make sure the child is inside the box
|
||||||
|
|
||||||
// get our current info
|
// get our current info
|
||||||
PRBool horiz = PR_FALSE;
|
|
||||||
scrolledBox->GetOrientation(horiz);
|
|
||||||
nsPoint cp;
|
nsPoint cp;
|
||||||
scrollableView->GetScrollPosition(cp.x,cp.y);
|
scrollableView->GetScrollPosition(cp.x,cp.y);
|
||||||
|
|
||||||
|
@ -315,7 +312,7 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollToElement(nsIDOMElement *child)
|
||||||
|
|
||||||
// we only scroll in the direction of the scrollbox orientation
|
// we only scroll in the direction of the scrollbox orientation
|
||||||
// always scroll to left or top edge of child element
|
// always scroll to left or top edge of child element
|
||||||
if (horiz) {
|
if (scrolledBox->IsHorizontal()) {
|
||||||
newx = rect.x - crect.x;
|
newx = rect.x - crect.x;
|
||||||
} else {
|
} else {
|
||||||
newy = rect.y - crect.y;
|
newy = rect.y - crect.y;
|
||||||
|
@ -429,9 +426,6 @@ NS_IMETHODIMP nsScrollBoxObject::EnsureElementIsVisible(nsIDOMElement *child)
|
||||||
// TODO: make sure the child is inside the box
|
// TODO: make sure the child is inside the box
|
||||||
|
|
||||||
// get our current info
|
// get our current info
|
||||||
PRBool horiz = PR_FALSE;
|
|
||||||
scrolledBox->GetOrientation(horiz);
|
|
||||||
|
|
||||||
nsPoint cp;
|
nsPoint cp;
|
||||||
scrollableView->GetScrollPosition(cp.x,cp.y);
|
scrollableView->GetScrollPosition(cp.x,cp.y);
|
||||||
GetOffsetRect(crect);
|
GetOffsetRect(crect);
|
||||||
|
@ -440,11 +434,10 @@ NS_IMETHODIMP nsScrollBoxObject::EnsureElementIsVisible(nsIDOMElement *child)
|
||||||
crect.width = NSToIntRound(crect.width * pixelsToTwips);
|
crect.width = NSToIntRound(crect.width * pixelsToTwips);
|
||||||
crect.height = NSToIntRound(crect.height * pixelsToTwips);
|
crect.height = NSToIntRound(crect.height * pixelsToTwips);
|
||||||
|
|
||||||
|
|
||||||
nscoord newx=cp.x, newy=cp.y;
|
nscoord newx=cp.x, newy=cp.y;
|
||||||
|
|
||||||
// we only scroll in the direction of the scrollbox orientation
|
// we only scroll in the direction of the scrollbox orientation
|
||||||
if (horiz) {
|
if (scrolledBox->IsHorizontal()) {
|
||||||
if ((rect.x - crect.x) + rect.width > cp.x + crect.width) {
|
if ((rect.x - crect.x) + rect.width > cp.x + crect.width) {
|
||||||
newx = cp.x + (((rect.x - crect.x) + rect.width)-(cp.x + crect.width));
|
newx = cp.x + (((rect.x - crect.x) + rect.width)-(cp.x + crect.width));
|
||||||
} else if (rect.x - crect.x < cp.x) {
|
} else if (rect.x - crect.x < cp.x) {
|
||||||
|
|
|
@ -387,10 +387,7 @@ nsSliderFrame::DoLayout(nsBoxLayoutState& aState)
|
||||||
if ((pageIncrement + maxpospx - minpospx) > 0)
|
if ((pageIncrement + maxpospx - minpospx) > 0)
|
||||||
{
|
{
|
||||||
// if the thumb is flexible make the thumb bigger.
|
// if the thumb is flexible make the thumb bigger.
|
||||||
nscoord flex = 0;
|
if (thumbBox->GetFlex(aState) > 0)
|
||||||
thumbBox->GetFlex(aState, flex);
|
|
||||||
|
|
||||||
if (flex > 0)
|
|
||||||
{
|
{
|
||||||
mRatio = float(pageIncrement) / float(maxpospx - minpospx + pageIncrement);
|
mRatio = float(pageIncrement) / float(maxpospx - minpospx + pageIncrement);
|
||||||
nscoord thumbsize = NSToCoordRound(ourmaxpos * mRatio);
|
nscoord thumbsize = NSToCoordRound(ourmaxpos * mRatio);
|
||||||
|
|
|
@ -344,9 +344,7 @@ nsSplitterFrame::Init(nsIContent* aContent,
|
||||||
// |newContext| to Release the reference after the call to nsBoxFrame::Init
|
// |newContext| to Release the reference after the call to nsBoxFrame::Init
|
||||||
nsRefPtr<nsStyleContext> newContext;
|
nsRefPtr<nsStyleContext> newContext;
|
||||||
if (aParent && aParent->IsBoxFrame()) {
|
if (aParent && aParent->IsBoxFrame()) {
|
||||||
PRBool isHorizontal;
|
if (!aParent->IsHorizontal()) {
|
||||||
aParent->GetOrientation(isHorizontal);
|
|
||||||
if (!isHorizontal) {
|
|
||||||
if (!nsContentUtils::HasNonEmptyAttr(aContent, kNameSpaceID_None,
|
if (!nsContentUtils::HasNonEmptyAttr(aContent, kNameSpaceID_None,
|
||||||
nsGkAtoms::orient)) {
|
nsGkAtoms::orient)) {
|
||||||
aContent->SetAttr(kNameSpaceID_None, nsGkAtoms::orient,
|
aContent->SetAttr(kNameSpaceID_None, nsGkAtoms::orient,
|
||||||
|
@ -400,9 +398,7 @@ nsSplitterFrame::GetInitialOrientation(PRBool& aIsHorizontal)
|
||||||
nsIBox* box;
|
nsIBox* box;
|
||||||
GetParentBox(&box);
|
GetParentBox(&box);
|
||||||
if (box) {
|
if (box) {
|
||||||
PRBool horizontal;
|
aIsHorizontal = !box->IsHorizontal();
|
||||||
box->GetOrientation(horizontal);
|
|
||||||
aIsHorizontal = !horizontal;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nsBoxFrame::GetInitialOrientation(aIsHorizontal);
|
nsBoxFrame::GetInitialOrientation(aIsHorizontal);
|
||||||
|
@ -784,8 +780,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||||
mOuter->AddMargin(childBox, prefSize);
|
mOuter->AddMargin(childBox, prefSize);
|
||||||
mOuter->AddMargin(childBox, maxSize);
|
mOuter->AddMargin(childBox, maxSize);
|
||||||
|
|
||||||
nscoord flex = 0;
|
nscoord flex = childBox->GetFlex(state);
|
||||||
childBox->GetFlex(state, flex);
|
|
||||||
|
|
||||||
nsMargin margin(0,0,0,0);
|
nsMargin margin(0,0,0,0);
|
||||||
childBox->GetMargin(margin);
|
childBox->GetMargin(margin);
|
||||||
|
@ -825,9 +820,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool isNormalDirection = PR_TRUE;
|
if (!mParentBox->IsNormalDirection()) {
|
||||||
mParentBox->GetDirection(isNormalDirection);
|
|
||||||
if (!isNormalDirection) {
|
|
||||||
// The before array is really the after array, and the order needs to be reversed.
|
// The before array is really the after array, and the order needs to be reversed.
|
||||||
// First reverse both arrays.
|
// First reverse both arrays.
|
||||||
Reverse(mChildInfosBefore, mChildInfosBeforeCount);
|
Reverse(mChildInfosBefore, mChildInfosBeforeCount);
|
||||||
|
|
|
@ -208,9 +208,7 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
// See if we are collapsed. If we are, then simply iterate over all our
|
// See if we are collapsed. If we are, then simply iterate over all our
|
||||||
// children and give them a rect of 0 width and height.
|
// children and give them a rect of 0 width and height.
|
||||||
PRBool collapsed = PR_FALSE;
|
if (aBox->IsCollapsed(aState)) {
|
||||||
aBox->IsCollapsed(aState, collapsed);
|
|
||||||
if (collapsed) {
|
|
||||||
nsIBox* child;
|
nsIBox* child;
|
||||||
aBox->GetChildBox(&child);
|
aBox->GetChildBox(&child);
|
||||||
while(child)
|
while(child)
|
||||||
|
@ -224,8 +222,7 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
|
||||||
aState.PushStackMemory();
|
aState.PushStackMemory();
|
||||||
|
|
||||||
// ----- figure out our size ----------
|
// ----- figure out our size ----------
|
||||||
nsRect contentRect;
|
nsSize originalSize = aBox->GetSize();
|
||||||
aBox->GetContentRect(contentRect);
|
|
||||||
|
|
||||||
// -- make sure we remove our border and padding ----
|
// -- make sure we remove our border and padding ----
|
||||||
nsRect clientRect;
|
nsRect clientRect;
|
||||||
|
@ -249,8 +246,7 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
|
||||||
nsBoxSize* boxSizes = nsnull;
|
nsBoxSize* boxSizes = nsnull;
|
||||||
nsComputedBoxSize* computedBoxSizes = nsnull;
|
nsComputedBoxSize* computedBoxSizes = nsnull;
|
||||||
|
|
||||||
nscoord maxAscent = 0;
|
nscoord maxAscent = aBox->GetBoxAscent(aState);
|
||||||
aBox->GetAscent(aState, maxAscent);
|
|
||||||
|
|
||||||
nscoord min = 0;
|
nscoord min = 0;
|
||||||
nscoord max = 0;
|
nscoord max = 0;
|
||||||
|
@ -663,14 +659,14 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
|
||||||
aBox->GetInset(bp);
|
aBox->GetInset(bp);
|
||||||
tmpClientRect.Inflate(bp);
|
tmpClientRect.Inflate(bp);
|
||||||
|
|
||||||
if (tmpClientRect.width > contentRect.width || tmpClientRect.height > contentRect.height)
|
if (tmpClientRect.width > originalSize.width || tmpClientRect.height > originalSize.height)
|
||||||
{
|
{
|
||||||
// if it did reset our bounds.
|
// if it did reset our bounds.
|
||||||
nsRect bounds(aBox->GetRect());
|
nsRect bounds(aBox->GetRect());
|
||||||
if (tmpClientRect.width > contentRect.width)
|
if (tmpClientRect.width > originalSize.width)
|
||||||
bounds.width = tmpClientRect.width;
|
bounds.width = tmpClientRect.width;
|
||||||
|
|
||||||
if (tmpClientRect.height > contentRect.height)
|
if (tmpClientRect.height > originalSize.height)
|
||||||
bounds.height = tmpClientRect.height;
|
bounds.height = tmpClientRect.height;
|
||||||
|
|
||||||
aBox->SetBounds(aState, bounds);
|
aBox->SetBounds(aState, bounds);
|
||||||
|
@ -770,12 +766,10 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
child->GetFlex(aState, flex);
|
flex = child->GetFlex(aState);
|
||||||
PRBool collapsed = PR_FALSE;
|
|
||||||
child->IsCollapsed(aState, collapsed);
|
|
||||||
|
|
||||||
currentBox->flex = flex;
|
currentBox->flex = flex;
|
||||||
currentBox->collapsed = collapsed;
|
currentBox->collapsed = child->IsCollapsed(aState);
|
||||||
} else {
|
} else {
|
||||||
flex = start->flex;
|
flex = start->flex;
|
||||||
start = start->next;
|
start = start->next;
|
||||||
|
@ -803,9 +797,7 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox
|
||||||
nsSize min(0,0);
|
nsSize min(0,0);
|
||||||
nsSize max(NS_INTRINSICSIZE,NS_INTRINSICSIZE);
|
nsSize max(NS_INTRINSICSIZE,NS_INTRINSICSIZE);
|
||||||
nscoord ascent = 0;
|
nscoord ascent = 0;
|
||||||
|
PRBool collapsed = child->IsCollapsed(aState);
|
||||||
PRBool collapsed = PR_FALSE;
|
|
||||||
child->IsCollapsed(aState, collapsed);
|
|
||||||
|
|
||||||
if (!collapsed) {
|
if (!collapsed) {
|
||||||
// only one flexible child? Cool we will just make its preferred size
|
// only one flexible child? Cool we will just make its preferred size
|
||||||
|
@ -815,7 +807,7 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox
|
||||||
pref = child->GetPrefSize(aState);
|
pref = child->GetPrefSize(aState);
|
||||||
min = child->GetMinSize(aState);
|
min = child->GetMinSize(aState);
|
||||||
max = child->GetMaxSize(aState);
|
max = child->GetMaxSize(aState);
|
||||||
child->GetAscent(aState, ascent);
|
ascent = child->GetBoxAscent(aState);
|
||||||
nsMargin margin;
|
nsMargin margin;
|
||||||
child->GetMargin(margin);
|
child->GetMargin(margin);
|
||||||
ascent += margin.top;
|
ascent += margin.top;
|
||||||
|
@ -854,8 +846,7 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox
|
||||||
prefWidth = pref.height;
|
prefWidth = pref.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord flex = 0;
|
nscoord flex = child->GetFlex(aState);
|
||||||
child->GetFlex(aState, flex);
|
|
||||||
|
|
||||||
// set them if you collapsed you are not flexible.
|
// set them if you collapsed you are not flexible.
|
||||||
if (collapsed) {
|
if (collapsed) {
|
||||||
|
@ -1349,10 +1340,7 @@ nsSprocketLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aS
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
// ignore collapsed children
|
// ignore collapsed children
|
||||||
PRBool isCollapsed = PR_FALSE;
|
if (!child->IsCollapsed(aState))
|
||||||
child->IsCollapsed(aState, isCollapsed);
|
|
||||||
|
|
||||||
if (!isCollapsed)
|
|
||||||
{
|
{
|
||||||
nsSize pref = child->GetPrefSize(aState);
|
nsSize pref = child->GetPrefSize(aState);
|
||||||
AddMargin(child, pref);
|
AddMargin(child, pref);
|
||||||
|
@ -1412,20 +1400,14 @@ nsSprocketLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
// ignore collapsed children
|
// ignore collapsed children
|
||||||
PRBool isCollapsed = PR_FALSE;
|
if (!aBox->IsCollapsed(aState))
|
||||||
aBox->IsCollapsed(aState, isCollapsed);
|
|
||||||
|
|
||||||
if (!isCollapsed)
|
|
||||||
{
|
{
|
||||||
nsSize min = child->GetMinSize(aState);
|
nsSize min = child->GetMinSize(aState);
|
||||||
nsSize pref(0,0);
|
nsSize pref(0,0);
|
||||||
nscoord flex = 0;
|
|
||||||
|
|
||||||
child->GetFlex(aState, flex);
|
|
||||||
|
|
||||||
// if the child is not flexible then
|
// if the child is not flexible then
|
||||||
// its min size is its pref size.
|
// its min size is its pref size.
|
||||||
if (flex == 0) {
|
if (child->GetFlex(aState) == 0) {
|
||||||
pref = child->GetPrefSize(aState);
|
pref = child->GetPrefSize(aState);
|
||||||
if (isHorizontal)
|
if (isHorizontal)
|
||||||
min.width = pref.width;
|
min.width = pref.width;
|
||||||
|
@ -1492,10 +1474,7 @@ nsSprocketLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
// ignore collapsed children
|
// ignore collapsed children
|
||||||
PRBool isCollapsed = PR_FALSE;
|
if (!aBox->IsCollapsed(aState))
|
||||||
aBox->IsCollapsed(aState, isCollapsed);
|
|
||||||
|
|
||||||
if (!isCollapsed)
|
|
||||||
{
|
{
|
||||||
// if completely redefined don't even ask our child for its size.
|
// if completely redefined don't even ask our child for its size.
|
||||||
nsSize max = child->GetMaxSize(aState);
|
nsSize max = child->GetMaxSize(aState);
|
||||||
|
@ -1560,14 +1539,10 @@ nsSprocketLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aAs
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
// ignore collapsed children
|
// ignore collapsed children
|
||||||
//PRBool isCollapsed = PR_FALSE;
|
//if (!aBox->IsCollapsed(aStatew))
|
||||||
//aBox->IsCollapsed(aState, isCollapsed);
|
|
||||||
|
|
||||||
//if (!isCollapsed)
|
|
||||||
//{
|
//{
|
||||||
// if completely redefined don't even ask our child for its size.
|
// if completely redefined don't even ask our child for its size.
|
||||||
nscoord ascent = 0;
|
nscoord ascent = child->GetBoxAscent(aState);
|
||||||
child->GetAscent(aState, ascent);
|
|
||||||
|
|
||||||
nsMargin margin;
|
nsMargin margin;
|
||||||
child->GetMargin(margin);
|
child->GetMargin(margin);
|
||||||
|
@ -1592,14 +1567,16 @@ nsSprocketLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aAs
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSprocketLayout::GetFlex(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aFlex)
|
nsSprocketLayout::GetFlex(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aFlex)
|
||||||
{
|
{
|
||||||
return aBox->GetFlex(aState, aFlex);
|
aFlex = aBox->GetFlex(aState);
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSprocketLayout::IsCollapsed(nsIBox* aBox, nsBoxLayoutState& aState, PRBool& aIsCollapsed)
|
nsSprocketLayout::IsCollapsed(nsIBox* aBox, nsBoxLayoutState& aState, PRBool& aIsCollapsed)
|
||||||
{
|
{
|
||||||
return aBox->IsCollapsed(aState, aIsCollapsed);
|
aIsCollapsed = aBox->IsCollapsed(aState);
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -170,8 +170,7 @@ nsStackLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aAscen
|
||||||
aBox->GetChildBox(&child);
|
aBox->GetChildBox(&child);
|
||||||
|
|
||||||
while (child) {
|
while (child) {
|
||||||
nscoord ascent = 0;
|
nscoord ascent = child->GetBoxAscent(aState);
|
||||||
child->GetAscent(aState, ascent);
|
|
||||||
nsMargin margin;
|
nsMargin margin;
|
||||||
child->GetMargin(margin);
|
child->GetMargin(margin);
|
||||||
ascent += margin.top + margin.bottom;
|
ascent += margin.top + margin.bottom;
|
||||||
|
|
|
@ -82,16 +82,6 @@ nsTitleBarFrame::Init(nsIContent* aContent,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsTitleBarFrame::GetMouseThrough(PRBool& aMouseThrough)
|
|
||||||
{
|
|
||||||
aMouseThrough = PR_FALSE;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsTitleBarFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
|
nsTitleBarFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
|
||||||
const nsRect& aDirtyRect,
|
const nsRect& aDirtyRect,
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
nsGUIEvent* aEvent,
|
nsGUIEvent* aEvent,
|
||||||
nsEventStatus* aEventStatus);
|
nsEventStatus* aEventStatus);
|
||||||
|
|
||||||
NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough);
|
virtual PRBool GetMouseThrough() const { return PR_FALSE; }
|
||||||
|
|
||||||
virtual void MouseClicked(nsPresContext* aPresContext, nsGUIEvent* aEvent);
|
virtual void MouseClicked(nsPresContext* aPresContext, nsGUIEvent* aEvent);
|
||||||
|
|
||||||
|
|
|
@ -759,9 +759,7 @@ FindScrollParts(nsIFrame* aCurrFrame, nsTreeBodyFrame::ScrollParts* aResult)
|
||||||
nsIScrollbarFrame *sf = nsnull;
|
nsIScrollbarFrame *sf = nsnull;
|
||||||
CallQueryInterface(aCurrFrame, &sf);
|
CallQueryInterface(aCurrFrame, &sf);
|
||||||
if (sf) {
|
if (sf) {
|
||||||
PRBool isHorizontal = PR_FALSE;
|
if (!aCurrFrame->IsHorizontal()) {
|
||||||
if (NS_SUCCEEDED(aCurrFrame->GetOrientation(isHorizontal))) {
|
|
||||||
if (!isHorizontal) {
|
|
||||||
if (!aResult->mVScrollbar) {
|
if (!aResult->mVScrollbar) {
|
||||||
aResult->mVScrollbar = sf;
|
aResult->mVScrollbar = sf;
|
||||||
}
|
}
|
||||||
|
@ -770,7 +768,6 @@ FindScrollParts(nsIFrame* aCurrFrame, nsTreeBodyFrame::ScrollParts* aResult)
|
||||||
aResult->mHScrollbar = sf;
|
aResult->mHScrollbar = sf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// don't bother searching inside a scrollbar
|
// don't bother searching inside a scrollbar
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче