mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 16:32:59 +00:00
Added support for incremental table painting
This commit is contained in:
parent
d94b3e63a0
commit
19fc1e01af
@ -2097,6 +2097,17 @@ nsresult nsTableFrame::AdjustSiblingsAfterReflow(nsIPresContext& aPresCon
|
||||
aReflowState.footerFrame->MoveTo(kidRect.x, kidRect.y);
|
||||
}
|
||||
}
|
||||
|
||||
// Invalidate the area we offset. Note that we only repaint within
|
||||
// our existing frame bounds.
|
||||
// XXX It would be better to bitblt the row frames and not repaint,
|
||||
// but we don't have such a view manager function yet...
|
||||
aKidFrame->GetRect(kidRect);
|
||||
if (kidRect.YMost() < mRect.height) {
|
||||
nsRect dirtyRect(0, kidRect.YMost(),
|
||||
mRect.width, mRect.height - kidRect.YMost());
|
||||
Invalidate(dirtyRect);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -2260,6 +2271,19 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext,
|
||||
return rv;
|
||||
}
|
||||
aDesiredSize.width = PR_MIN(aDesiredSize.width, pass1Width);
|
||||
|
||||
// If this is an incremental reflow and we're here that means we had to
|
||||
// reflow all the rows, e.g., the column widths changed. We need to make
|
||||
// sure that any damaged areas are repainted
|
||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||
nsRect damageRect;
|
||||
|
||||
damageRect.x = 0;
|
||||
damageRect.y = 0;
|
||||
damageRect.width = mRect.width;
|
||||
damageRect.height = mRect.height;
|
||||
Invalidate(damageRect);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2268,19 +2292,6 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext,
|
||||
|
||||
SetColumnDimensions(aDesiredSize.height);
|
||||
|
||||
// If this is an incremental reflow, then we need to make sure that any
|
||||
// damaged areas are repainted
|
||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||
nsRect damageRect;
|
||||
|
||||
// XXX We need finer granularity than this...
|
||||
damageRect.x = 0;
|
||||
damageRect.y = 0;
|
||||
damageRect.width = mRect.width;
|
||||
damageRect.height = mRect.height;
|
||||
Invalidate(damageRect);
|
||||
}
|
||||
|
||||
if (nsDebugTable::gRflTable) nsTableFrame::DebugReflow("T::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
return rv;
|
||||
}
|
||||
@ -3342,11 +3353,24 @@ NS_METHOD nsTableFrame::IR_TargetIsChild(nsIPresContext& aPresContext,
|
||||
// that follow. Otherwise, return and we'll recompute the column widths
|
||||
// and reflow all the row group frames
|
||||
if (!NeedsReflow(aReflowState.reflowState)) {
|
||||
// If the row group frame changed height, then damage the horizontal strip
|
||||
// that was either added or went away
|
||||
if (desiredSize.height != oldKidRect.height) {
|
||||
nsRect dirtyRect;
|
||||
|
||||
dirtyRect.x = 0;
|
||||
dirtyRect.y = PR_MIN(oldKidRect.YMost(), kidRect.YMost());
|
||||
dirtyRect.width = mRect.width;
|
||||
dirtyRect.height = PR_MAX(oldKidRect.YMost(), kidRect.YMost()) -
|
||||
dirtyRect.y;
|
||||
Invalidate(dirtyRect);
|
||||
}
|
||||
|
||||
// Adjust the row groups that follow
|
||||
AdjustSiblingsAfterReflow(aPresContext, aReflowState, aNextFrame,
|
||||
aDesiredSize.maxElementSize, desiredSize.height -
|
||||
oldKidRect.height);
|
||||
|
||||
|
||||
// Return our size and our status
|
||||
aDesiredSize.width = ComputeDesiredWidth(aReflowState.reflowState);
|
||||
nscoord defaultHeight = aReflowState.y + aReflowState.mBorderPadding.top +
|
||||
|
@ -821,8 +821,6 @@ nsTableRowGroupFrame::AdjustSiblingsAfterReflow(nsIPresContext& aPresContex
|
||||
kidFrame->GetOrigin(origin);
|
||||
origin.y += aDeltaY;
|
||||
|
||||
// XXX We need to send move notifications to the frame. At least see if
|
||||
// views need to be repositioned
|
||||
nsIHTMLReflow* htmlReflow;
|
||||
if (NS_OK == kidFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
|
||||
htmlReflow->WillReflow(aPresContext);
|
||||
@ -1507,14 +1505,50 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext& aPresConte
|
||||
// If the row has no cells that span into or across the row, then we
|
||||
// don't have to call CalculateRowHeights() which is quite expensive
|
||||
if (IsSimpleRowFrame(aReflowState.tableFrame, aNextFrame)) {
|
||||
// Inform the row of its new height.
|
||||
((nsTableRowFrame*)aNextFrame)->DidResize(aPresContext, aReflowState.reflowState);
|
||||
|
||||
// Adjust the frames that follow...
|
||||
AdjustSiblingsAfterReflow(aPresContext, aReflowState, aNextFrame,
|
||||
aDesiredSize.maxElementSize,
|
||||
desiredSize.height - oldKidRect.height);
|
||||
aDesiredSize.height = aReflowState.y;
|
||||
// XXX This optimization isn't ready to be enabled yet, because the
|
||||
// row frame code needs to change to size the cell frame and vertically
|
||||
// align it and either bitblt it into its new position or repaint
|
||||
#if 0
|
||||
// See if the row changed height
|
||||
if (oldKidRect.height == desiredSize.height) {
|
||||
// We don't need to do any painting. The row frame has made sure that
|
||||
// the cell is properly positioned, and done any necessary repainting.
|
||||
// Just calculate our desired height
|
||||
nsIFrame* lastKidFrame = mFrames.LastChild();
|
||||
nsRect lastKidRect;
|
||||
|
||||
lastKidFrame->GetRect(lastKidRect);
|
||||
aDesiredSize.height = lastKidRect.YMost();
|
||||
|
||||
} else {
|
||||
#endif
|
||||
// Inform the row of its new height.
|
||||
((nsTableRowFrame*)aNextFrame)->DidResize(aPresContext, aReflowState.reflowState);
|
||||
|
||||
// Because other cells in the row may need to be be aligned differently,
|
||||
// repaint the entire row
|
||||
// XXX Improve this so the row knows it should bitblt (or repaint) those
|
||||
// cells that change position...
|
||||
Invalidate(kidRect);
|
||||
|
||||
// Invalidate the area we're offseting. Note that we only repaint within
|
||||
// our existing frame bounds.
|
||||
// XXX It would be better to bitblt the row frames and not repaint,
|
||||
// but we don't have such a view manager function yet...
|
||||
if (kidRect.YMost() < mRect.height) {
|
||||
nsRect dirtyRect(0, kidRect.YMost(),
|
||||
mRect.width, mRect.height - kidRect.YMost());
|
||||
Invalidate(dirtyRect);
|
||||
}
|
||||
|
||||
// Adjust the frames that follow
|
||||
AdjustSiblingsAfterReflow(aPresContext, aReflowState, aNextFrame,
|
||||
aDesiredSize.maxElementSize,
|
||||
desiredSize.height - oldKidRect.height);
|
||||
aDesiredSize.height = aReflowState.y;
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
|
||||
} else {
|
||||
// Adjust the frames that follow...
|
||||
@ -1524,6 +1558,12 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext& aPresConte
|
||||
|
||||
// Now recalculate the row heights
|
||||
CalculateRowHeights(aPresContext, aDesiredSize, aReflowState.reflowState);
|
||||
|
||||
// Because we don't know what changed repaint everything.
|
||||
// XXX We should change CalculateRowHeights() to return the bounding
|
||||
// rect of what changed. Or whether anything moved or changed size...
|
||||
nsRect dirtyRect(0, 0, mRect.width, mRect.height);
|
||||
Invalidate(dirtyRect);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2097,6 +2097,17 @@ nsresult nsTableFrame::AdjustSiblingsAfterReflow(nsIPresContext& aPresCon
|
||||
aReflowState.footerFrame->MoveTo(kidRect.x, kidRect.y);
|
||||
}
|
||||
}
|
||||
|
||||
// Invalidate the area we offset. Note that we only repaint within
|
||||
// our existing frame bounds.
|
||||
// XXX It would be better to bitblt the row frames and not repaint,
|
||||
// but we don't have such a view manager function yet...
|
||||
aKidFrame->GetRect(kidRect);
|
||||
if (kidRect.YMost() < mRect.height) {
|
||||
nsRect dirtyRect(0, kidRect.YMost(),
|
||||
mRect.width, mRect.height - kidRect.YMost());
|
||||
Invalidate(dirtyRect);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -2260,6 +2271,19 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext,
|
||||
return rv;
|
||||
}
|
||||
aDesiredSize.width = PR_MIN(aDesiredSize.width, pass1Width);
|
||||
|
||||
// If this is an incremental reflow and we're here that means we had to
|
||||
// reflow all the rows, e.g., the column widths changed. We need to make
|
||||
// sure that any damaged areas are repainted
|
||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||
nsRect damageRect;
|
||||
|
||||
damageRect.x = 0;
|
||||
damageRect.y = 0;
|
||||
damageRect.width = mRect.width;
|
||||
damageRect.height = mRect.height;
|
||||
Invalidate(damageRect);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2268,19 +2292,6 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext,
|
||||
|
||||
SetColumnDimensions(aDesiredSize.height);
|
||||
|
||||
// If this is an incremental reflow, then we need to make sure that any
|
||||
// damaged areas are repainted
|
||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||
nsRect damageRect;
|
||||
|
||||
// XXX We need finer granularity than this...
|
||||
damageRect.x = 0;
|
||||
damageRect.y = 0;
|
||||
damageRect.width = mRect.width;
|
||||
damageRect.height = mRect.height;
|
||||
Invalidate(damageRect);
|
||||
}
|
||||
|
||||
if (nsDebugTable::gRflTable) nsTableFrame::DebugReflow("T::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
return rv;
|
||||
}
|
||||
@ -3342,11 +3353,24 @@ NS_METHOD nsTableFrame::IR_TargetIsChild(nsIPresContext& aPresContext,
|
||||
// that follow. Otherwise, return and we'll recompute the column widths
|
||||
// and reflow all the row group frames
|
||||
if (!NeedsReflow(aReflowState.reflowState)) {
|
||||
// If the row group frame changed height, then damage the horizontal strip
|
||||
// that was either added or went away
|
||||
if (desiredSize.height != oldKidRect.height) {
|
||||
nsRect dirtyRect;
|
||||
|
||||
dirtyRect.x = 0;
|
||||
dirtyRect.y = PR_MIN(oldKidRect.YMost(), kidRect.YMost());
|
||||
dirtyRect.width = mRect.width;
|
||||
dirtyRect.height = PR_MAX(oldKidRect.YMost(), kidRect.YMost()) -
|
||||
dirtyRect.y;
|
||||
Invalidate(dirtyRect);
|
||||
}
|
||||
|
||||
// Adjust the row groups that follow
|
||||
AdjustSiblingsAfterReflow(aPresContext, aReflowState, aNextFrame,
|
||||
aDesiredSize.maxElementSize, desiredSize.height -
|
||||
oldKidRect.height);
|
||||
|
||||
|
||||
// Return our size and our status
|
||||
aDesiredSize.width = ComputeDesiredWidth(aReflowState.reflowState);
|
||||
nscoord defaultHeight = aReflowState.y + aReflowState.mBorderPadding.top +
|
||||
|
@ -821,8 +821,6 @@ nsTableRowGroupFrame::AdjustSiblingsAfterReflow(nsIPresContext& aPresContex
|
||||
kidFrame->GetOrigin(origin);
|
||||
origin.y += aDeltaY;
|
||||
|
||||
// XXX We need to send move notifications to the frame. At least see if
|
||||
// views need to be repositioned
|
||||
nsIHTMLReflow* htmlReflow;
|
||||
if (NS_OK == kidFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
|
||||
htmlReflow->WillReflow(aPresContext);
|
||||
@ -1507,14 +1505,50 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext& aPresConte
|
||||
// If the row has no cells that span into or across the row, then we
|
||||
// don't have to call CalculateRowHeights() which is quite expensive
|
||||
if (IsSimpleRowFrame(aReflowState.tableFrame, aNextFrame)) {
|
||||
// Inform the row of its new height.
|
||||
((nsTableRowFrame*)aNextFrame)->DidResize(aPresContext, aReflowState.reflowState);
|
||||
|
||||
// Adjust the frames that follow...
|
||||
AdjustSiblingsAfterReflow(aPresContext, aReflowState, aNextFrame,
|
||||
aDesiredSize.maxElementSize,
|
||||
desiredSize.height - oldKidRect.height);
|
||||
aDesiredSize.height = aReflowState.y;
|
||||
// XXX This optimization isn't ready to be enabled yet, because the
|
||||
// row frame code needs to change to size the cell frame and vertically
|
||||
// align it and either bitblt it into its new position or repaint
|
||||
#if 0
|
||||
// See if the row changed height
|
||||
if (oldKidRect.height == desiredSize.height) {
|
||||
// We don't need to do any painting. The row frame has made sure that
|
||||
// the cell is properly positioned, and done any necessary repainting.
|
||||
// Just calculate our desired height
|
||||
nsIFrame* lastKidFrame = mFrames.LastChild();
|
||||
nsRect lastKidRect;
|
||||
|
||||
lastKidFrame->GetRect(lastKidRect);
|
||||
aDesiredSize.height = lastKidRect.YMost();
|
||||
|
||||
} else {
|
||||
#endif
|
||||
// Inform the row of its new height.
|
||||
((nsTableRowFrame*)aNextFrame)->DidResize(aPresContext, aReflowState.reflowState);
|
||||
|
||||
// Because other cells in the row may need to be be aligned differently,
|
||||
// repaint the entire row
|
||||
// XXX Improve this so the row knows it should bitblt (or repaint) those
|
||||
// cells that change position...
|
||||
Invalidate(kidRect);
|
||||
|
||||
// Invalidate the area we're offseting. Note that we only repaint within
|
||||
// our existing frame bounds.
|
||||
// XXX It would be better to bitblt the row frames and not repaint,
|
||||
// but we don't have such a view manager function yet...
|
||||
if (kidRect.YMost() < mRect.height) {
|
||||
nsRect dirtyRect(0, kidRect.YMost(),
|
||||
mRect.width, mRect.height - kidRect.YMost());
|
||||
Invalidate(dirtyRect);
|
||||
}
|
||||
|
||||
// Adjust the frames that follow
|
||||
AdjustSiblingsAfterReflow(aPresContext, aReflowState, aNextFrame,
|
||||
aDesiredSize.maxElementSize,
|
||||
desiredSize.height - oldKidRect.height);
|
||||
aDesiredSize.height = aReflowState.y;
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
|
||||
} else {
|
||||
// Adjust the frames that follow...
|
||||
@ -1524,6 +1558,12 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext& aPresConte
|
||||
|
||||
// Now recalculate the row heights
|
||||
CalculateRowHeights(aPresContext, aDesiredSize, aReflowState.reflowState);
|
||||
|
||||
// Because we don't know what changed repaint everything.
|
||||
// XXX We should change CalculateRowHeights() to return the bounding
|
||||
// rect of what changed. Or whether anything moved or changed size...
|
||||
nsRect dirtyRect(0, 0, mRect.width, mRect.height);
|
||||
Invalidate(dirtyRect);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user