зеркало из https://github.com/mozilla/gecko-dev.git
More savory tree widget goodness.
This commit is contained in:
Родитель
12c8c31d6e
Коммит
37db4271b6
|
@ -3027,7 +3027,7 @@ nsCSSFrameConstructor::CreateAnonymousXULContent(nsIPresContext* aPresContext,
|
|||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
|
||||
content->SetParent(aContent);
|
||||
|
||||
|
||||
nsCOMPtr<nsIAtom> vertical = dont_AddRef(NS_NewAtom("align"));
|
||||
nsCOMPtr<nsIAtom> style = dont_AddRef(NS_NewAtom("style"));
|
||||
|
||||
|
|
|
@ -3027,7 +3027,7 @@ nsCSSFrameConstructor::CreateAnonymousXULContent(nsIPresContext* aPresContext,
|
|||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
|
||||
content->SetParent(aContent);
|
||||
|
||||
|
||||
nsCOMPtr<nsIAtom> vertical = dont_AddRef(NS_NewAtom("align"));
|
||||
nsCOMPtr<nsIAtom> style = dont_AddRef(NS_NewAtom("style"));
|
||||
|
||||
|
|
|
@ -4205,8 +4205,8 @@ void nsTableFrame::DistributeSpaceToCells(nsIPresContext& aPresContext,
|
|||
nsIFrame* aRowGroupFrame)
|
||||
{
|
||||
// now that all of the rows have been resized, resize the cells
|
||||
nsTableIterator iter2(*aRowGroupFrame, eTableLTR);
|
||||
nsIFrame* rowFrame = iter2.First();
|
||||
nsTableRowGroupFrame* rowGroupFrame = (nsTableRowGroupFrame*)aRowGroupFrame;
|
||||
nsIFrame * rowFrame = rowGroupFrame->GetFirstFrame();
|
||||
while (nsnull!=rowFrame) {
|
||||
const nsStyleDisplay *rowDisplay;
|
||||
rowFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)rowDisplay));
|
||||
|
@ -4216,7 +4216,7 @@ void nsTableFrame::DistributeSpaceToCells(nsIPresContext& aPresContext,
|
|||
// The calling function, DistributeSpaceToRows, takes care of the recursive row
|
||||
// group descent, which is why there's no NS_STYLE_DISPLAY_TABLE_ROW_GROUP case
|
||||
// here.
|
||||
rowFrame = iter2.Next();
|
||||
rowGroupFrame->GetNextFrame(rowFrame, &rowFrame);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4229,9 +4229,8 @@ void nsTableFrame::DistributeSpaceToRows(nsIPresContext& aPresContext,
|
|||
{
|
||||
// the rows in rowGroupFrame need to be expanded by rowHeightDelta[i]
|
||||
// and the rowgroup itself needs to be expanded by SUM(row height deltas)
|
||||
nsIFrame * rowFrame=nsnull;
|
||||
nsTableIterator iter(*aRowGroupFrame, eTableLTR);
|
||||
rowFrame = iter.First();
|
||||
nsTableRowGroupFrame* rowGroupFrame = (nsTableRowGroupFrame*)aRowGroupFrame;
|
||||
nsIFrame * rowFrame = rowGroupFrame->GetFirstFrame();
|
||||
nscoord y = 0;
|
||||
while (nsnull!=rowFrame)
|
||||
{
|
||||
|
@ -4247,19 +4246,23 @@ void nsTableFrame::DistributeSpaceToRows(nsIPresContext& aPresContext,
|
|||
rowFrame->GetRect(rowRect);
|
||||
float percent = ((float)(rowRect.height)) / ((float)(aSumOfRowHeights));
|
||||
nscoord excessForRow = NSToCoordRound((float)aExcess*percent);
|
||||
nsRect newRowRect(rowRect.x, y, rowRect.width, excessForRow+rowRect.height);
|
||||
rowFrame->SetRect(newRowRect);
|
||||
if (NS_STYLE_BORDER_COLLAPSE==aTableStyle->mBorderCollapse)
|
||||
{
|
||||
nsBorderEdge *border = (nsBorderEdge *)
|
||||
(mBorderEdges.mEdges[NS_SIDE_LEFT].ElementAt(((nsTableRowFrame*)rowFrame)->GetRowIndex()));
|
||||
border->mLength=newRowRect.height;
|
||||
border = (nsBorderEdge *)
|
||||
(mBorderEdges.mEdges[NS_SIDE_RIGHT].ElementAt(((nsTableRowFrame*)rowFrame)->GetRowIndex()));
|
||||
border->mLength=newRowRect.height;
|
||||
|
||||
if (rowGroupFrame->RowsDesireExcessSpace()) {
|
||||
nsRect newRowRect(rowRect.x, y, rowRect.width, excessForRow+rowRect.height);
|
||||
rowFrame->SetRect(newRowRect);
|
||||
if (NS_STYLE_BORDER_COLLAPSE==aTableStyle->mBorderCollapse)
|
||||
{
|
||||
nsBorderEdge *border = (nsBorderEdge *)
|
||||
(mBorderEdges.mEdges[NS_SIDE_LEFT].ElementAt(((nsTableRowFrame*)rowFrame)->GetRowIndex()));
|
||||
border->mLength=newRowRect.height;
|
||||
border = (nsBorderEdge *)
|
||||
(mBorderEdges.mEdges[NS_SIDE_RIGHT].ElementAt(((nsTableRowFrame*)rowFrame)->GetRowIndex()));
|
||||
border->mLength=newRowRect.height;
|
||||
}
|
||||
// better if this were part of an overloaded row::SetRect
|
||||
y += excessForRow+rowRect.height;
|
||||
}
|
||||
// better if this were part of an overloaded row::SetRect
|
||||
y += excessForRow+rowRect.height;
|
||||
|
||||
aExcessForRowGroup += excessForRow;
|
||||
}
|
||||
else
|
||||
|
@ -4269,14 +4272,17 @@ void nsTableFrame::DistributeSpaceToRows(nsIPresContext& aPresContext,
|
|||
y += rowRect.height;
|
||||
}
|
||||
|
||||
rowFrame = iter.Next();
|
||||
rowGroupFrame->GetNextFrame(rowFrame, &rowFrame);
|
||||
}
|
||||
nsRect rowGroupRect;
|
||||
aRowGroupFrame->GetRect(rowGroupRect);
|
||||
nsRect newRowGroupRect(rowGroupRect.x, aRowGroupYPos, rowGroupRect.width, aExcessForRowGroup+rowGroupRect.height);
|
||||
aRowGroupFrame->SetRect(newRowGroupRect);
|
||||
|
||||
aRowGroupYPos += aExcessForRowGroup + rowGroupRect.height;
|
||||
nsRect rowGroupRect;
|
||||
aRowGroupFrame->GetRect(rowGroupRect);
|
||||
if (rowGroupFrame->RowGroupDesiresExcessSpace()) {
|
||||
nsRect newRowGroupRect(rowGroupRect.x, aRowGroupYPos, rowGroupRect.width, aExcessForRowGroup+rowGroupRect.height);
|
||||
aRowGroupFrame->SetRect(newRowGroupRect);
|
||||
aRowGroupYPos += aExcessForRowGroup + rowGroupRect.height;
|
||||
}
|
||||
else aRowGroupYPos += rowGroupRect.height;
|
||||
|
||||
DistributeSpaceToCells(aPresContext, aReflowState, aRowGroupFrame);
|
||||
}
|
||||
|
|
|
@ -298,10 +298,14 @@ protected:
|
|||
virtual PRBool ExcludeFrameFromReflow(nsIFrame* aFrame) { return PR_FALSE; };
|
||||
virtual nsIFrame* GetFirstFrameForReflow(nsIPresContext& aPresContext) { return mFrames.FirstChild(); };
|
||||
virtual void GetNextFrameForReflow(nsIPresContext& aPresContext, nsIFrame* aFrame, nsIFrame** aResult) { aFrame->GetNextSibling(aResult); };
|
||||
void GetNextRowSibling(nsIFrame** aRowFrame);
|
||||
|
||||
public:
|
||||
virtual nsIFrame* GetFirstFrame() { return mFrames.FirstChild(); };
|
||||
virtual nsIFrame* GetLastFrame() { return mFrames.LastChild(); };
|
||||
virtual void GetNextFrame(nsIFrame* aFrame, nsIFrame** aResult) { aFrame->GetNextSibling(aResult); };
|
||||
void GetNextRowSibling(nsIFrame** aRowFrame);
|
||||
virtual PRBool RowsDesireExcessSpace() { return PR_TRUE; };
|
||||
virtual PRBool RowGroupDesiresExcessSpace() { return PR_TRUE; };
|
||||
|
||||
private:
|
||||
nsIAtom *mType;
|
||||
|
|
|
@ -4205,8 +4205,8 @@ void nsTableFrame::DistributeSpaceToCells(nsIPresContext& aPresContext,
|
|||
nsIFrame* aRowGroupFrame)
|
||||
{
|
||||
// now that all of the rows have been resized, resize the cells
|
||||
nsTableIterator iter2(*aRowGroupFrame, eTableLTR);
|
||||
nsIFrame* rowFrame = iter2.First();
|
||||
nsTableRowGroupFrame* rowGroupFrame = (nsTableRowGroupFrame*)aRowGroupFrame;
|
||||
nsIFrame * rowFrame = rowGroupFrame->GetFirstFrame();
|
||||
while (nsnull!=rowFrame) {
|
||||
const nsStyleDisplay *rowDisplay;
|
||||
rowFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)rowDisplay));
|
||||
|
@ -4216,7 +4216,7 @@ void nsTableFrame::DistributeSpaceToCells(nsIPresContext& aPresContext,
|
|||
// The calling function, DistributeSpaceToRows, takes care of the recursive row
|
||||
// group descent, which is why there's no NS_STYLE_DISPLAY_TABLE_ROW_GROUP case
|
||||
// here.
|
||||
rowFrame = iter2.Next();
|
||||
rowGroupFrame->GetNextFrame(rowFrame, &rowFrame);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4229,9 +4229,8 @@ void nsTableFrame::DistributeSpaceToRows(nsIPresContext& aPresContext,
|
|||
{
|
||||
// the rows in rowGroupFrame need to be expanded by rowHeightDelta[i]
|
||||
// and the rowgroup itself needs to be expanded by SUM(row height deltas)
|
||||
nsIFrame * rowFrame=nsnull;
|
||||
nsTableIterator iter(*aRowGroupFrame, eTableLTR);
|
||||
rowFrame = iter.First();
|
||||
nsTableRowGroupFrame* rowGroupFrame = (nsTableRowGroupFrame*)aRowGroupFrame;
|
||||
nsIFrame * rowFrame = rowGroupFrame->GetFirstFrame();
|
||||
nscoord y = 0;
|
||||
while (nsnull!=rowFrame)
|
||||
{
|
||||
|
@ -4247,19 +4246,23 @@ void nsTableFrame::DistributeSpaceToRows(nsIPresContext& aPresContext,
|
|||
rowFrame->GetRect(rowRect);
|
||||
float percent = ((float)(rowRect.height)) / ((float)(aSumOfRowHeights));
|
||||
nscoord excessForRow = NSToCoordRound((float)aExcess*percent);
|
||||
nsRect newRowRect(rowRect.x, y, rowRect.width, excessForRow+rowRect.height);
|
||||
rowFrame->SetRect(newRowRect);
|
||||
if (NS_STYLE_BORDER_COLLAPSE==aTableStyle->mBorderCollapse)
|
||||
{
|
||||
nsBorderEdge *border = (nsBorderEdge *)
|
||||
(mBorderEdges.mEdges[NS_SIDE_LEFT].ElementAt(((nsTableRowFrame*)rowFrame)->GetRowIndex()));
|
||||
border->mLength=newRowRect.height;
|
||||
border = (nsBorderEdge *)
|
||||
(mBorderEdges.mEdges[NS_SIDE_RIGHT].ElementAt(((nsTableRowFrame*)rowFrame)->GetRowIndex()));
|
||||
border->mLength=newRowRect.height;
|
||||
|
||||
if (rowGroupFrame->RowsDesireExcessSpace()) {
|
||||
nsRect newRowRect(rowRect.x, y, rowRect.width, excessForRow+rowRect.height);
|
||||
rowFrame->SetRect(newRowRect);
|
||||
if (NS_STYLE_BORDER_COLLAPSE==aTableStyle->mBorderCollapse)
|
||||
{
|
||||
nsBorderEdge *border = (nsBorderEdge *)
|
||||
(mBorderEdges.mEdges[NS_SIDE_LEFT].ElementAt(((nsTableRowFrame*)rowFrame)->GetRowIndex()));
|
||||
border->mLength=newRowRect.height;
|
||||
border = (nsBorderEdge *)
|
||||
(mBorderEdges.mEdges[NS_SIDE_RIGHT].ElementAt(((nsTableRowFrame*)rowFrame)->GetRowIndex()));
|
||||
border->mLength=newRowRect.height;
|
||||
}
|
||||
// better if this were part of an overloaded row::SetRect
|
||||
y += excessForRow+rowRect.height;
|
||||
}
|
||||
// better if this were part of an overloaded row::SetRect
|
||||
y += excessForRow+rowRect.height;
|
||||
|
||||
aExcessForRowGroup += excessForRow;
|
||||
}
|
||||
else
|
||||
|
@ -4269,14 +4272,17 @@ void nsTableFrame::DistributeSpaceToRows(nsIPresContext& aPresContext,
|
|||
y += rowRect.height;
|
||||
}
|
||||
|
||||
rowFrame = iter.Next();
|
||||
rowGroupFrame->GetNextFrame(rowFrame, &rowFrame);
|
||||
}
|
||||
nsRect rowGroupRect;
|
||||
aRowGroupFrame->GetRect(rowGroupRect);
|
||||
nsRect newRowGroupRect(rowGroupRect.x, aRowGroupYPos, rowGroupRect.width, aExcessForRowGroup+rowGroupRect.height);
|
||||
aRowGroupFrame->SetRect(newRowGroupRect);
|
||||
|
||||
aRowGroupYPos += aExcessForRowGroup + rowGroupRect.height;
|
||||
nsRect rowGroupRect;
|
||||
aRowGroupFrame->GetRect(rowGroupRect);
|
||||
if (rowGroupFrame->RowGroupDesiresExcessSpace()) {
|
||||
nsRect newRowGroupRect(rowGroupRect.x, aRowGroupYPos, rowGroupRect.width, aExcessForRowGroup+rowGroupRect.height);
|
||||
aRowGroupFrame->SetRect(newRowGroupRect);
|
||||
aRowGroupYPos += aExcessForRowGroup + rowGroupRect.height;
|
||||
}
|
||||
else aRowGroupYPos += rowGroupRect.height;
|
||||
|
||||
DistributeSpaceToCells(aPresContext, aReflowState, aRowGroupFrame);
|
||||
}
|
||||
|
|
|
@ -298,10 +298,14 @@ protected:
|
|||
virtual PRBool ExcludeFrameFromReflow(nsIFrame* aFrame) { return PR_FALSE; };
|
||||
virtual nsIFrame* GetFirstFrameForReflow(nsIPresContext& aPresContext) { return mFrames.FirstChild(); };
|
||||
virtual void GetNextFrameForReflow(nsIPresContext& aPresContext, nsIFrame* aFrame, nsIFrame** aResult) { aFrame->GetNextSibling(aResult); };
|
||||
void GetNextRowSibling(nsIFrame** aRowFrame);
|
||||
|
||||
public:
|
||||
virtual nsIFrame* GetFirstFrame() { return mFrames.FirstChild(); };
|
||||
virtual nsIFrame* GetLastFrame() { return mFrames.LastChild(); };
|
||||
virtual void GetNextFrame(nsIFrame* aFrame, nsIFrame** aResult) { aFrame->GetNextSibling(aResult); };
|
||||
void GetNextRowSibling(nsIFrame** aRowFrame);
|
||||
virtual PRBool RowsDesireExcessSpace() { return PR_TRUE; };
|
||||
virtual PRBool RowGroupDesiresExcessSpace() { return PR_TRUE; };
|
||||
|
||||
private:
|
||||
nsIAtom *mType;
|
||||
|
|
|
@ -65,6 +65,74 @@ nsTreeRowGroupFrame::~nsTreeRowGroupFrame()
|
|||
{
|
||||
}
|
||||
|
||||
PRBool nsTreeRowGroupFrame::RowGroupDesiresExcessSpace()
|
||||
{
|
||||
nsIFrame* parentFrame;
|
||||
GetParent(&parentFrame);
|
||||
const nsStyleDisplay *display;
|
||||
parentFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));
|
||||
if (display->mDisplay == NS_STYLE_DISPLAY_TABLE_ROW_GROUP)
|
||||
return PR_FALSE; // Nested groups don't grow.
|
||||
else return PR_TRUE; // The outermost group can grow.
|
||||
}
|
||||
|
||||
PRBool nsTreeRowGroupFrame::RowGroupReceivesExcessSpace()
|
||||
{
|
||||
const nsStyleDisplay *display;
|
||||
GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));
|
||||
if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == display->mDisplay)
|
||||
return PR_TRUE;
|
||||
else return PR_FALSE; // Headers and footers don't get excess space.
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTreeRowGroupFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame)
|
||||
{
|
||||
nsPoint tmp;
|
||||
nsRect kidRect;
|
||||
if (mScrollbar) {
|
||||
mScrollbar->GetRect(kidRect);
|
||||
if (kidRect.Contains(aPoint)) {
|
||||
tmp.MoveTo(aPoint.x - kidRect.x, aPoint.y - kidRect.y);
|
||||
return mScrollbar->GetFrameForPoint(tmp, aFrame);
|
||||
}
|
||||
}
|
||||
|
||||
return nsTableRowGroupFrame::GetFrameForPoint(aPoint, aFrame);
|
||||
}
|
||||
|
||||
void nsTreeRowGroupFrame::PaintChildren(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
nsTableRowGroupFrame::PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
||||
|
||||
if (mScrollbar) {
|
||||
nsIView *pView;
|
||||
|
||||
mScrollbar->GetView(&pView);
|
||||
if (nsnull == pView) {
|
||||
PRBool clipState;
|
||||
nsRect kidRect;
|
||||
mScrollbar->GetRect(kidRect);
|
||||
nsRect damageArea(aDirtyRect);
|
||||
// Translate damage area into kid's coordinate system
|
||||
nsRect kidDamageArea(damageArea.x - kidRect.x, damageArea.y - kidRect.y,
|
||||
damageArea.width, damageArea.height);
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.Translate(kidRect.x, kidRect.y);
|
||||
mScrollbar->Paint(aPresContext, aRenderingContext, kidDamageArea, aWhichLayer);
|
||||
if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) &&
|
||||
GetShowFrameBorders()) {
|
||||
aRenderingContext.SetColor(NS_RGB(255,0,0));
|
||||
aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height);
|
||||
}
|
||||
aRenderingContext.PopState(clipState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTreeRowGroupFrame::ReflowBeforeRowLayout(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
|
|
@ -41,6 +41,12 @@ public:
|
|||
NS_IMETHOD TreeInsertFrames(nsIFrame* aPrevFrame,
|
||||
nsIFrame* aFrameList);
|
||||
|
||||
NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame);
|
||||
void PaintChildren(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
PRBool ContinueReflow(nscoord y, nscoord height);
|
||||
|
||||
PRBool IsFull() { return mIsFull; };
|
||||
|
@ -48,12 +54,18 @@ public:
|
|||
// Responses to changes
|
||||
void OnContentAdded(nsIPresContext& aPresContext);
|
||||
|
||||
virtual nsIFrame* GetFirstFrame();
|
||||
virtual nsIFrame* GetLastFrame();
|
||||
virtual void GetNextFrame(nsIFrame* aFrame, nsIFrame** aResult);
|
||||
virtual PRBool RowsDesireExcessSpace() { return PR_FALSE; };
|
||||
virtual PRBool RowGroupDesiresExcessSpace();
|
||||
|
||||
protected:
|
||||
nsTreeRowGroupFrame();
|
||||
virtual ~nsTreeRowGroupFrame();
|
||||
|
||||
virtual PRBool RowGroupReceivesExcessSpace() { return PR_FALSE; };
|
||||
|
||||
virtual PRBool RowGroupReceivesExcessSpace();
|
||||
|
||||
NS_IMETHOD ReflowBeforeRowLayout(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
RowGroupReflowState& aReflowState,
|
||||
|
@ -63,10 +75,6 @@ protected:
|
|||
virtual nsIFrame* GetFirstFrameForReflow(nsIPresContext& aPresContext);
|
||||
virtual void GetNextFrameForReflow(nsIPresContext& aPresContext, nsIFrame* aFrame, nsIFrame** aResult);
|
||||
|
||||
virtual nsIFrame* GetFirstFrame();
|
||||
virtual nsIFrame* GetLastFrame();
|
||||
virtual void GetNextFrame(nsIFrame* aFrame, nsIFrame** aResult);
|
||||
|
||||
void LocateFrame(nsIFrame* aStartFrame, nsIFrame** aResult);
|
||||
|
||||
protected: // Data Members
|
||||
|
|
Загрузка…
Ссылка в новой задаче