Bug 1157569 part 8 - Move some code in BCPaintBorderIterator::SetDamageArea for less computation. r=roc

--HG--
extra : source : ccac169ecb8651b6a9f598444f228bdf14866f2c
This commit is contained in:
Xidorn Quan 2015-05-04 19:09:25 +12:00
Родитель df305b8624
Коммит a6a99c50ec
1 изменённых файлов: 8 добавлений и 7 удалений

Просмотреть файл

@ -6407,15 +6407,13 @@ BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect)
nsTableRowGroupFrame* rgFrame = mRowGroups[rgX];
for (nsTableRowFrame* rowFrame = rgFrame->GetFirstRow(); rowFrame;
rowFrame = rowFrame->GetNextRow()) {
// conservatively estimate the half border widths outside the row
nscoord topBorderHalf = (mTable->GetPrevInFlow()) ? 0 :
nsPresContext::CSSPixelsToAppUnits(rowFrame->GetTopBCBorderWidth() + 1);
nscoord bottomBorderHalf = (mTable->GetNextInFlow()) ? 0 :
nsPresContext::CSSPixelsToAppUnits(rowFrame->GetBottomBCBorderWidth() + 1);
// get the row rect relative to the table rather than the row group
nsSize rowSize = rowFrame->GetSize();
if (haveIntersect) {
if (aDirtyRect.YMost() >= (rowY - topBorderHalf)) {
// conservatively estimate the half border widths outside the row
nscoord borderHalf = mTable->GetPrevInFlow() ? 0 : nsPresContext::
CSSPixelsToAppUnits(rowFrame->GetTopBCBorderWidth() + 1);
if (aDirtyRect.YMost() >= rowY - borderHalf) {
nsTableRowFrame* fifRow =
static_cast<nsTableRowFrame*>(rowFrame->FirstInFlow());
endRowIndex = fifRow->GetRowIndex();
@ -6423,7 +6421,10 @@ BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect)
else done = true;
}
else {
if ((rowY + rowSize.height + bottomBorderHalf) >= aDirtyRect.y) {
// conservatively estimate the half border widths outside the row
nscoord borderHalf = mTable->GetNextInFlow() ? 0 : nsPresContext::
CSSPixelsToAppUnits(rowFrame->GetBottomBCBorderWidth() + 1);
if (rowY + rowSize.height + borderHalf >= aDirtyRect.y) {
mStartRg = rgFrame;
mStartRow = rowFrame;
nsTableRowFrame* fifRow =