Bug 1409114 - Part 7: Pass rects in display list coordinates to AppendBackgroundItemsToTop. r=miko

This helps for the next patch, since some of the table backgrounds items want to compute this without position:relative taken into account.

Differential Revision: https://phabricator.services.mozilla.com/D29279

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Woodrow 2019-05-20 23:15:54 +00:00
Родитель 8bf47621c6
Коммит 1f9adb1ed4
9 изменённых файлов: 26 добавлений и 13 удалений

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

@ -237,7 +237,7 @@ bool nsDisplayButtonBorder::CreateWebRenderCommands(
nsDisplayListBuilder* aDisplayListBuilder) {
// This is really a combination of paint box shadow inner +
// paint border.
nsRect buttonRect = nsRect(ToReferenceFrame(), mFrame->GetSize());
const nsRect buttonRect = nsRect(ToReferenceFrame(), mFrame->GetSize());
bool snap;
nsRegion visible = GetBounds(aDisplayListBuilder, &snap);
nsDisplayBoxShadowInner::CreateInsetBoxShadowWebRenderCommands(
@ -394,7 +394,8 @@ nsresult nsButtonFrameRenderer::DisplayButton(nsDisplayListBuilder* aBuilder,
GetFrame());
}
nsRect buttonRect = mFrame->GetRectRelativeToSelf();
nsRect buttonRect =
mFrame->GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(mFrame);
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(aBuilder, mFrame,
buttonRect, aBackground);

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

@ -224,9 +224,11 @@ void nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
IsVisibleForPainting()) {
DisplayOutsetBoxShadowUnconditional(aBuilder, aLists.BorderBackground());
const nsRect rect =
VisualBorderRectRelativeToSelf() + aBuilder->ToReferenceFrame(this);
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
aBuilder, this, VisualBorderRectRelativeToSelf(),
aLists.BorderBackground(),
aBuilder, this, rect, aLists.BorderBackground(),
/* aAllowWillPaintBorderOptimization = */ false);
aLists.BorderBackground()->AppendNewToTop<nsDisplayFieldSetBorder>(aBuilder,

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

@ -2436,7 +2436,9 @@ bool nsFrame::DisplayBackgroundUnconditional(nsDisplayListBuilder* aBuilder,
!StyleBackground()->IsTransparent(this) ||
StyleDisplay()->HasAppearance()) {
return nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
aBuilder, this, GetRectRelativeToSelf(), aLists.BorderBackground());
aBuilder, this,
GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(this),
aLists.BorderBackground());
}
return false;
}

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

@ -1837,7 +1837,8 @@ void nsMathMLChar::Display(nsDisplayListBuilder* aBuilder, nsIFrame* aForFrame,
NS_GET_A(computedStyle->StyleBackground()->BackgroundColor(
computedStyle)) > 0) {
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
aBuilder, aForFrame, mRect, aLists.BorderBackground(),
aBuilder, aForFrame, mRect + aBuilder->ToReferenceFrame(aForFrame),
aLists.BorderBackground(),
/* aAllowWillPaintBorderOptimization */ true, computedStyle);
}
// else

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

@ -3820,10 +3820,10 @@ bool nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
const nsRect& aBackgroundOriginRect, nsIFrame* aSecondaryReferenceFrame) {
ComputedStyle* bgSC = aComputedStyle;
const nsStyleBackground* bg = nullptr;
nsRect bgRect = aBackgroundRect + aBuilder->ToReferenceFrame(aFrame);
nsRect bgRect = aBackgroundRect;
nsRect bgOriginRect = bgRect;
if (!aBackgroundOriginRect.IsEmpty()) {
bgOriginRect = aBackgroundOriginRect + aBuilder->ToReferenceFrame(aFrame);
bgOriginRect = aBackgroundOriginRect;
}
nsPresContext* presContext = aFrame->PresContext();
bool isThemed = aFrame->IsThemed();

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

@ -450,12 +450,14 @@ void nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
aBuilder, this);
}
nsRect bgRect = GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(this);
// display background if we need to.
if (aBuilder->IsForEventDelivery() ||
!StyleBackground()->IsTransparent(this) ||
StyleDisplay()->HasAppearance()) {
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
aBuilder, this, GetRectRelativeToSelf(), aLists.BorderBackground());
aBuilder, this, bgRect, aLists.BorderBackground());
}
// display inset box-shadows if we need to.

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

@ -536,6 +536,7 @@ void nsTableRowFrame::PaintCellBackgroundsForFrame(
nsIFrame* aFrame, nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists, const nsPoint& aOffset) {
// Compute background rect by iterating all cell frame.
const nsPoint toReferenceFrame = aBuilder->ToReferenceFrame(aFrame);
for (nsTableCellFrame* cell = GetFirstCell(); cell;
cell = cell->GetNextCell()) {
if (!cell->ShouldPaintBackground(aBuilder)) {
@ -547,9 +548,10 @@ void nsTableRowFrame::PaintCellBackgroundsForFrame(
if (!aBuilder->GetDirtyRect().Intersects(cellRect)) {
continue;
}
cellRect += toReferenceFrame;
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
aBuilder, aFrame, cellRect, aLists.BorderBackground(), true, nullptr,
aFrame->GetRectRelativeToSelf(), cell);
aFrame->GetRectRelativeToSelf() + toReferenceFrame, cell);
}
}

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

@ -262,14 +262,16 @@ void nsTableRowGroupFrame::PaintCellBackgroundsForColumns(
continue;
}
auto cellPos = cell->GetNormalPosition() + rowPos;
auto cellPos = cell->GetNormalPosition() + rowPos +
aBuilder->ToReferenceFrame(aFrame);
auto cellRect = nsRect(cellPos, cell->GetSize());
if (!aBuilder->GetDirtyRect().Intersects(cellRect)) {
continue;
}
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
aBuilder, aFrame, cellRect, aList, false, nullptr,
aFrame->GetRectRelativeToSelf(), cell);
aFrame->GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(aFrame),
cell);
}
}
}

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

@ -153,7 +153,8 @@ void nsGroupBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// Paint our background and border
if (IsVisibleForPainting()) {
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
aBuilder, this, GetBackgroundRectRelativeToSelf(),
aBuilder, this,
GetBackgroundRectRelativeToSelf() + aBuilder->ToReferenceFrame(this),
aLists.BorderBackground());
aLists.BorderBackground()->AppendNewToTop<nsDisplayXULGroupBorder>(aBuilder,
this);