зеркало из https://github.com/mozilla/gecko-dev.git
Don't do translation during table border painting. b=421069 Patch by Robert O'Callahan <roc@ocallahan.org>. r+sr=dbaron approval1.9b5=damon
This commit is contained in:
Родитель
23a009990b
Коммит
a8fd009d52
|
@ -1396,12 +1396,10 @@ nsTableFrame::PaintTableBorderBackground(nsIRenderingContext& aRenderingContext,
|
|||
nsPoint aPt)
|
||||
{
|
||||
nsPresContext* presContext = PresContext();
|
||||
nsRect dirtyRect = aDirtyRect - aPt;
|
||||
nsIRenderingContext::AutoPushTranslation
|
||||
translate(&aRenderingContext, aPt.x, aPt.y);
|
||||
|
||||
TableBackgroundPainter painter(this, TableBackgroundPainter::eOrigin_Table,
|
||||
presContext, aRenderingContext, dirtyRect);
|
||||
presContext, aRenderingContext,
|
||||
aDirtyRect, aPt);
|
||||
nsresult rv;
|
||||
|
||||
if (eCompatibility_NavQuirks == presContext->CompatibilityMode()) {
|
||||
|
@ -1429,15 +1427,18 @@ nsTableFrame::PaintTableBorderBackground(nsIRenderingContext& aRenderingContext,
|
|||
|
||||
if (GetStyleVisibility()->IsVisible()) {
|
||||
const nsStyleBorder* border = GetStyleBorder();
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
if (!IsBorderCollapse()) {
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
nsRect rect(aPt, mRect.Size());
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
dirtyRect, rect, *border, mStyleContext,
|
||||
aDirtyRect, rect, *border, mStyleContext,
|
||||
skipSides);
|
||||
}
|
||||
else {
|
||||
PaintBCBorders(aRenderingContext, dirtyRect);
|
||||
// XXX we should probably get rid of this translation at some stage
|
||||
// But that would mean modifying PaintBCBorders, ugh
|
||||
nsIRenderingContext::AutoPushTranslation translate(&aRenderingContext, aPt.x, aPt.y);
|
||||
PaintBCBorders(aRenderingContext, aDirtyRect - aPt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -223,9 +223,11 @@ TableBackgroundPainter::TableBackgroundPainter(nsTableFrame* aTableFrame,
|
|||
Origin aOrigin,
|
||||
nsPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
const nsRect& aDirtyRect,
|
||||
const nsPoint& aRenderPt)
|
||||
: mPresContext(aPresContext),
|
||||
mRenderingContext(aRenderingContext),
|
||||
mRenderPt(aRenderPt),
|
||||
mDirtyRect(aDirtyRect),
|
||||
mOrigin(aOrigin),
|
||||
mCols(nsnull),
|
||||
|
@ -315,7 +317,7 @@ TableBackgroundPainter::PaintTableFrame(nsTableFrame* aTableFrame,
|
|||
if (tableData.IsVisible()) {
|
||||
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
|
||||
tableData.mFrame, mDirtyRect,
|
||||
tableData.mRect,
|
||||
tableData.mRect + mRenderPt,
|
||||
*tableData.mBackground,
|
||||
*tableData.mBorder,
|
||||
mZeroPadding, PR_TRUE);
|
||||
|
@ -328,8 +330,7 @@ void
|
|||
TableBackgroundPainter::TranslateContext(nscoord aDX,
|
||||
nscoord aDY)
|
||||
{
|
||||
mRenderingContext.Translate(aDX, aDY);
|
||||
mDirtyRect.MoveBy(-aDX, -aDY);
|
||||
mRenderPt += nsPoint(aDX, aDY);
|
||||
if (mCols) {
|
||||
TableBackgroundData* lastColGroup = nsnull;
|
||||
for (PRUint32 i = 0; i < mNumCols; i++) {
|
||||
|
@ -441,7 +442,7 @@ TableBackgroundPainter::PaintTable(nsTableFrame* aTableFrame,
|
|||
// Need to compute the right rect via GetOffsetTo, since the row
|
||||
// group may not be a child of the table.
|
||||
mRowGroup.mRect.MoveTo(rg->GetOffsetTo(aTableFrame));
|
||||
if (mRowGroup.mRect.Intersects(mDirtyRect)) {
|
||||
if (mRowGroup.mRect.Intersects(mDirtyRect - mRenderPt)) {
|
||||
nsresult rv = PaintRowGroup(rg, rg->IsPseudoStackingContextFromStyle());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
@ -495,9 +496,10 @@ TableBackgroundPainter::PaintRowGroup(nsTableRowGroupFrame* aFrame,
|
|||
// their originating row. We do care about overflow below,
|
||||
// however, since that can be due to rowspans.
|
||||
|
||||
// Note that mDirtyRect is guaranteed to be in the row group's coordinate
|
||||
// system here, so passing its .y to GetFirstRowContaining is ok.
|
||||
nsIFrame* cursor = aFrame->GetFirstRowContaining(mDirtyRect.y, &ignored);
|
||||
// Note that mDirtyRect - mRenderPt is guaranteed to be in the row
|
||||
// group's coordinate system here, so passing its .y to
|
||||
// GetFirstRowContaining is ok.
|
||||
nsIFrame* cursor = aFrame->GetFirstRowContaining(mDirtyRect.y - mRenderPt.y, &ignored);
|
||||
|
||||
// Sadly, it seems like there may be non-row frames in there... or something?
|
||||
// There are certainly null-checks in GetFirstRow() and GetNextRow(). :(
|
||||
|
@ -518,7 +520,7 @@ TableBackgroundPainter::PaintRowGroup(nsTableRowGroupFrame* aFrame,
|
|||
/* Finally paint */
|
||||
for (; row; row = row->GetNextRow()) {
|
||||
mRow.SetFrame(row);
|
||||
if (mDirtyRect.YMost() < mRow.mRect.y) { // Intersect wouldn't handle
|
||||
if (mDirtyRect.YMost() - mRenderPt.y < mRow.mRect.y) { // Intersect wouldn't handle
|
||||
// rowspans.
|
||||
|
||||
// All done; cells originating in later rows can't intersect mDirtyRect.
|
||||
|
@ -585,7 +587,7 @@ TableBackgroundPainter::PaintRow(nsTableRowFrame* aFrame,
|
|||
mCellRect = cell->GetRect();
|
||||
//Translate to use the same coord system as mRow.
|
||||
mCellRect.MoveBy(mRow.mRect.x, mRow.mRect.y);
|
||||
if (mCellRect.Intersects(mDirtyRect)) {
|
||||
if (mCellRect.Intersects(mDirtyRect - mRenderPt)) {
|
||||
nsresult rv = PaintCell(cell, aPassThrough || cell->IsPseudoStackingContextFromStyle());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
@ -617,7 +619,7 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
|
|||
if (mCols && mCols[colIndex].mColGroup && mCols[colIndex].mColGroup->IsVisible()) {
|
||||
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
|
||||
mCols[colIndex].mColGroup->mFrame, mDirtyRect,
|
||||
mCols[colIndex].mColGroup->mRect,
|
||||
mCols[colIndex].mColGroup->mRect + mRenderPt,
|
||||
*mCols[colIndex].mColGroup->mBackground,
|
||||
*mCols[colIndex].mColGroup->mBorder,
|
||||
mZeroPadding, PR_TRUE, &mCellRect);
|
||||
|
@ -627,7 +629,7 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
|
|||
if (mCols && mCols[colIndex].mCol.IsVisible()) {
|
||||
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
|
||||
mCols[colIndex].mCol.mFrame, mDirtyRect,
|
||||
mCols[colIndex].mCol.mRect,
|
||||
mCols[colIndex].mCol.mRect + mRenderPt,
|
||||
*mCols[colIndex].mCol.mBackground,
|
||||
*mCols[colIndex].mCol.mBorder,
|
||||
mZeroPadding, PR_TRUE, &mCellRect);
|
||||
|
@ -636,7 +638,8 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
|
|||
//Paint row group background
|
||||
if (mRowGroup.IsVisible()) {
|
||||
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
|
||||
mRowGroup.mFrame, mDirtyRect, mRowGroup.mRect,
|
||||
mRowGroup.mFrame, mDirtyRect,
|
||||
mRowGroup.mRect + mRenderPt,
|
||||
*mRowGroup.mBackground, *mRowGroup.mBorder,
|
||||
mZeroPadding, PR_TRUE, &mCellRect);
|
||||
}
|
||||
|
@ -644,14 +647,16 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
|
|||
//Paint row background
|
||||
if (mRow.IsVisible()) {
|
||||
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
|
||||
mRow.mFrame, mDirtyRect, mRow.mRect,
|
||||
mRow.mFrame, mDirtyRect,
|
||||
mRow.mRect + mRenderPt,
|
||||
*mRow.mBackground, *mRow.mBorder,
|
||||
mZeroPadding, PR_TRUE, &mCellRect);
|
||||
}
|
||||
|
||||
//Paint cell background in border-collapse unless we're just passing
|
||||
if (mIsBorderCollapse && !aPassSelf) {
|
||||
aCell->PaintCellBackground(mRenderingContext, mDirtyRect, mCellRect.TopLeft());
|
||||
aCell->PaintCellBackground(mRenderingContext, mDirtyRect,
|
||||
mRenderPt + mCellRect.TopLeft());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -68,13 +68,17 @@ class TableBackgroundPainter
|
|||
* @param aOrigin - what type of table frame is creating this instance
|
||||
* @param aPresContext - the presentation context
|
||||
* @param aRenderingContext - the rendering context
|
||||
* @param aDirtyRect - the area that needs to be painted
|
||||
* @param aDirtyRect - the area that needs to be painted,
|
||||
* relative to aRenderingContext
|
||||
* @param aPt - offset of the table frame relative to
|
||||
* aRenderingContext
|
||||
*/
|
||||
TableBackgroundPainter(nsTableFrame* aTableFrame,
|
||||
Origin aOrigin,
|
||||
nsPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
const nsRect& aDirtyRect,
|
||||
const nsPoint& aPt);
|
||||
|
||||
/** Destructor */
|
||||
~TableBackgroundPainter();
|
||||
|
@ -223,6 +227,7 @@ class TableBackgroundPainter
|
|||
|
||||
nsPresContext* mPresContext;
|
||||
nsIRenderingContext& mRenderingContext;
|
||||
nsPoint mRenderPt;
|
||||
nsRect mDirtyRect;
|
||||
#ifdef DEBUG
|
||||
nsCompatibility mCompatMode;
|
||||
|
|
|
@ -574,11 +574,10 @@ nsDisplayTableRowBackground::Paint(nsDisplayListBuilder* aBuilder,
|
|||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(mFrame);
|
||||
|
||||
nsPoint pt = aBuilder->ToReferenceFrame(mFrame);
|
||||
nsIRenderingContext::AutoPushTranslation translate(aCtx, pt.x, pt.y);
|
||||
TableBackgroundPainter painter(tableFrame,
|
||||
TableBackgroundPainter::eOrigin_TableRow,
|
||||
mFrame->PresContext(), *aCtx,
|
||||
aDirtyRect - pt);
|
||||
aDirtyRect, pt);
|
||||
painter.PaintRow(static_cast<nsTableRowFrame*>(mFrame));
|
||||
}
|
||||
|
||||
|
|
|
@ -193,11 +193,10 @@ PaintRowGroupBackground(nsIFrame* aFrame, nsIRenderingContext* aCtx,
|
|||
{
|
||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(aFrame);
|
||||
|
||||
nsIRenderingContext::AutoPushTranslation translate(aCtx, aPt.x, aPt.y);
|
||||
TableBackgroundPainter painter(tableFrame,
|
||||
TableBackgroundPainter::eOrigin_TableRowGroup,
|
||||
aFrame->PresContext(), *aCtx,
|
||||
aDirtyRect - aPt);
|
||||
aDirtyRect, aPt);
|
||||
painter.PaintRowGroup(static_cast<nsTableRowGroupFrame*>(aFrame));
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче