bug 12590 - vertical-align:middle working on cell
This commit is contained in:
@@ -396,23 +396,24 @@ void nsTableCellFrame::VerticallyAlignChild()
|
|||||||
switch (verticalAlignFlags)
|
switch (verticalAlignFlags)
|
||||||
{
|
{
|
||||||
case NS_STYLE_VERTICAL_ALIGN_BASELINE:
|
case NS_STYLE_VERTICAL_ALIGN_BASELINE:
|
||||||
// Align the child's baseline at the max baseline
|
// Align the baselines of the child frame with the baselines of
|
||||||
//kidYTop = aMaxAscent - kidAscent;
|
// other children in the same row which have align = baseline
|
||||||
break;
|
// XXX Not yet implemented, so fall through to top
|
||||||
|
|
||||||
case NS_STYLE_VERTICAL_ALIGN_TOP:
|
case NS_STYLE_VERTICAL_ALIGN_TOP:
|
||||||
// Align the top of the child frame with the top of the box,
|
// Align the top of the child frame with the top of the content area,
|
||||||
// minus the top padding
|
|
||||||
kidYTop = topInset;
|
kidYTop = topInset;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
||||||
|
// Align the bottom of the child frame with the bottom of the content area,
|
||||||
kidYTop = height - childHeight - bottomInset;
|
kidYTop = height - childHeight - bottomInset;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
||||||
kidYTop = height/2 - childHeight/2;
|
// Align the middle of the child frame with the middle of the content area,
|
||||||
|
kidYTop = (height - childHeight - bottomInset + topInset) / 2;
|
||||||
}
|
}
|
||||||
firstKid->MoveTo(kidRect.x, kidYTop);
|
firstKid->MoveTo(kidRect.x, kidYTop);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,12 +60,14 @@ static NS_DEFINE_IID(kITableRowGroupFrameIID, NS_ITABLEROWGROUPFRAME_IID);
|
|||||||
static const PRInt32 kColumnWidthIncrement=100;
|
static const PRInt32 kColumnWidthIncrement=100;
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
PRBool nsDebugTable::gRflTableOuter = PR_FALSE;
|
||||||
PRBool nsDebugTable::gRflTable = PR_FALSE;
|
PRBool nsDebugTable::gRflTable = PR_FALSE;
|
||||||
PRBool nsDebugTable::gRflRowGrp = PR_FALSE;
|
PRBool nsDebugTable::gRflRowGrp = PR_FALSE;
|
||||||
PRBool nsDebugTable::gRflRow = PR_FALSE;
|
PRBool nsDebugTable::gRflRow = PR_FALSE;
|
||||||
PRBool nsDebugTable::gRflCell = PR_FALSE;
|
PRBool nsDebugTable::gRflCell = PR_FALSE;
|
||||||
PRBool nsDebugTable::gRflArea = PR_FALSE;
|
PRBool nsDebugTable::gRflArea = PR_FALSE;
|
||||||
#else
|
#else
|
||||||
|
PRBool nsDebugTable::gRflTableOuter = PR_TRUE;
|
||||||
PRBool nsDebugTable::gRflTable = PR_TRUE;
|
PRBool nsDebugTable::gRflTable = PR_TRUE;
|
||||||
PRBool nsDebugTable::gRflRowGrp = PR_TRUE;
|
PRBool nsDebugTable::gRflRowGrp = PR_TRUE;
|
||||||
PRBool nsDebugTable::gRflRow = PR_TRUE;
|
PRBool nsDebugTable::gRflRow = PR_TRUE;
|
||||||
@@ -5353,7 +5355,8 @@ void nsTableFrame::DebugGetIndent(const nsIFrame* aFrame,
|
|||||||
while (parent) {
|
while (parent) {
|
||||||
nsIAtom* frameType = nsnull;
|
nsIAtom* frameType = nsnull;
|
||||||
parent->GetFrameType(&frameType);
|
parent->GetFrameType(&frameType);
|
||||||
if ((nsDebugTable::gRflTable && (nsLayoutAtoms::tableFrame == frameType)) ||
|
if ((nsDebugTable::gRflTableOuter && (nsLayoutAtoms::tableOuterFrame == frameType)) ||
|
||||||
|
(nsDebugTable::gRflTable && (nsLayoutAtoms::tableFrame == frameType)) ||
|
||||||
(nsDebugTable::gRflRowGrp && (nsLayoutAtoms::tableRowGroupFrame == frameType)) ||
|
(nsDebugTable::gRflRowGrp && (nsLayoutAtoms::tableRowGroupFrame == frameType)) ||
|
||||||
(nsDebugTable::gRflRow && (nsLayoutAtoms::tableRowFrame == frameType)) ||
|
(nsDebugTable::gRflRow && (nsLayoutAtoms::tableRowFrame == frameType)) ||
|
||||||
(nsDebugTable::gRflCell && (nsLayoutAtoms::tableCellFrame == frameType)) ||
|
(nsDebugTable::gRflCell && (nsLayoutAtoms::tableCellFrame == frameType)) ||
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ struct nsStyleSpacing;
|
|||||||
|
|
||||||
struct nsDebugTable
|
struct nsDebugTable
|
||||||
{
|
{
|
||||||
|
static PRBool gRflTableOuter;
|
||||||
static PRBool gRflTable;
|
static PRBool gRflTable;
|
||||||
static PRBool gRflRowGrp;
|
static PRBool gRflRowGrp;
|
||||||
static PRBool gRflRow;
|
static PRBool gRflRow;
|
||||||
|
|||||||
@@ -860,6 +860,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext,
|
|||||||
const nsHTMLReflowState& aReflowState,
|
const nsHTMLReflowState& aReflowState,
|
||||||
nsReflowStatus& aStatus)
|
nsReflowStatus& aStatus)
|
||||||
{
|
{
|
||||||
|
if (nsDebugTable::gRflTableOuter) nsTableFrame::DebugReflow("TO::Rfl en", this, &aReflowState, nsnull);
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
// Initialize out parameters
|
// Initialize out parameters
|
||||||
@@ -1004,6 +1005,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext,
|
|||||||
aDesiredSize.ascent = aDesiredSize.height;
|
aDesiredSize.ascent = aDesiredSize.height;
|
||||||
aDesiredSize.descent = 0;
|
aDesiredSize.descent = 0;
|
||||||
|
|
||||||
|
if (nsDebugTable::gRflTableOuter) nsTableFrame::DebugReflow("TO::Rfl ex", this, nsnull, &aDesiredSize);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -396,23 +396,24 @@ void nsTableCellFrame::VerticallyAlignChild()
|
|||||||
switch (verticalAlignFlags)
|
switch (verticalAlignFlags)
|
||||||
{
|
{
|
||||||
case NS_STYLE_VERTICAL_ALIGN_BASELINE:
|
case NS_STYLE_VERTICAL_ALIGN_BASELINE:
|
||||||
// Align the child's baseline at the max baseline
|
// Align the baselines of the child frame with the baselines of
|
||||||
//kidYTop = aMaxAscent - kidAscent;
|
// other children in the same row which have align = baseline
|
||||||
break;
|
// XXX Not yet implemented, so fall through to top
|
||||||
|
|
||||||
case NS_STYLE_VERTICAL_ALIGN_TOP:
|
case NS_STYLE_VERTICAL_ALIGN_TOP:
|
||||||
// Align the top of the child frame with the top of the box,
|
// Align the top of the child frame with the top of the content area,
|
||||||
// minus the top padding
|
|
||||||
kidYTop = topInset;
|
kidYTop = topInset;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
||||||
|
// Align the bottom of the child frame with the bottom of the content area,
|
||||||
kidYTop = height - childHeight - bottomInset;
|
kidYTop = height - childHeight - bottomInset;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
||||||
kidYTop = height/2 - childHeight/2;
|
// Align the middle of the child frame with the middle of the content area,
|
||||||
|
kidYTop = (height - childHeight - bottomInset + topInset) / 2;
|
||||||
}
|
}
|
||||||
firstKid->MoveTo(kidRect.x, kidYTop);
|
firstKid->MoveTo(kidRect.x, kidYTop);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,12 +60,14 @@ static NS_DEFINE_IID(kITableRowGroupFrameIID, NS_ITABLEROWGROUPFRAME_IID);
|
|||||||
static const PRInt32 kColumnWidthIncrement=100;
|
static const PRInt32 kColumnWidthIncrement=100;
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
PRBool nsDebugTable::gRflTableOuter = PR_FALSE;
|
||||||
PRBool nsDebugTable::gRflTable = PR_FALSE;
|
PRBool nsDebugTable::gRflTable = PR_FALSE;
|
||||||
PRBool nsDebugTable::gRflRowGrp = PR_FALSE;
|
PRBool nsDebugTable::gRflRowGrp = PR_FALSE;
|
||||||
PRBool nsDebugTable::gRflRow = PR_FALSE;
|
PRBool nsDebugTable::gRflRow = PR_FALSE;
|
||||||
PRBool nsDebugTable::gRflCell = PR_FALSE;
|
PRBool nsDebugTable::gRflCell = PR_FALSE;
|
||||||
PRBool nsDebugTable::gRflArea = PR_FALSE;
|
PRBool nsDebugTable::gRflArea = PR_FALSE;
|
||||||
#else
|
#else
|
||||||
|
PRBool nsDebugTable::gRflTableOuter = PR_TRUE;
|
||||||
PRBool nsDebugTable::gRflTable = PR_TRUE;
|
PRBool nsDebugTable::gRflTable = PR_TRUE;
|
||||||
PRBool nsDebugTable::gRflRowGrp = PR_TRUE;
|
PRBool nsDebugTable::gRflRowGrp = PR_TRUE;
|
||||||
PRBool nsDebugTable::gRflRow = PR_TRUE;
|
PRBool nsDebugTable::gRflRow = PR_TRUE;
|
||||||
@@ -5353,7 +5355,8 @@ void nsTableFrame::DebugGetIndent(const nsIFrame* aFrame,
|
|||||||
while (parent) {
|
while (parent) {
|
||||||
nsIAtom* frameType = nsnull;
|
nsIAtom* frameType = nsnull;
|
||||||
parent->GetFrameType(&frameType);
|
parent->GetFrameType(&frameType);
|
||||||
if ((nsDebugTable::gRflTable && (nsLayoutAtoms::tableFrame == frameType)) ||
|
if ((nsDebugTable::gRflTableOuter && (nsLayoutAtoms::tableOuterFrame == frameType)) ||
|
||||||
|
(nsDebugTable::gRflTable && (nsLayoutAtoms::tableFrame == frameType)) ||
|
||||||
(nsDebugTable::gRflRowGrp && (nsLayoutAtoms::tableRowGroupFrame == frameType)) ||
|
(nsDebugTable::gRflRowGrp && (nsLayoutAtoms::tableRowGroupFrame == frameType)) ||
|
||||||
(nsDebugTable::gRflRow && (nsLayoutAtoms::tableRowFrame == frameType)) ||
|
(nsDebugTable::gRflRow && (nsLayoutAtoms::tableRowFrame == frameType)) ||
|
||||||
(nsDebugTable::gRflCell && (nsLayoutAtoms::tableCellFrame == frameType)) ||
|
(nsDebugTable::gRflCell && (nsLayoutAtoms::tableCellFrame == frameType)) ||
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ struct nsStyleSpacing;
|
|||||||
|
|
||||||
struct nsDebugTable
|
struct nsDebugTable
|
||||||
{
|
{
|
||||||
|
static PRBool gRflTableOuter;
|
||||||
static PRBool gRflTable;
|
static PRBool gRflTable;
|
||||||
static PRBool gRflRowGrp;
|
static PRBool gRflRowGrp;
|
||||||
static PRBool gRflRow;
|
static PRBool gRflRow;
|
||||||
|
|||||||
@@ -860,6 +860,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext,
|
|||||||
const nsHTMLReflowState& aReflowState,
|
const nsHTMLReflowState& aReflowState,
|
||||||
nsReflowStatus& aStatus)
|
nsReflowStatus& aStatus)
|
||||||
{
|
{
|
||||||
|
if (nsDebugTable::gRflTableOuter) nsTableFrame::DebugReflow("TO::Rfl en", this, &aReflowState, nsnull);
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
// Initialize out parameters
|
// Initialize out parameters
|
||||||
@@ -1004,6 +1005,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext,
|
|||||||
aDesiredSize.ascent = aDesiredSize.height;
|
aDesiredSize.ascent = aDesiredSize.height;
|
||||||
aDesiredSize.descent = 0;
|
aDesiredSize.descent = 0;
|
||||||
|
|
||||||
|
if (nsDebugTable::gRflTableOuter) nsTableFrame::DebugReflow("TO::Rfl ex", this, nsnull, &aDesiredSize);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user