Bug 1409114 - Part 9: Used cached values instead of calling nsDisplayListBuilder::ToReferenceFrame when possible, since it can be expensive when the requested frame isn't the builder's current frame. r=miko

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Woodrow 2019-05-20 23:16:22 +00:00
Родитель 9f39c7b608
Коммит 0b73d82714
2 изменённых файлов: 9 добавлений и 10 удалений

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

@ -3764,8 +3764,8 @@ static nsIFrame* GetBackgroundComputedStyleFrame(nsIFrame* aFrame) {
static void SetBackgroundClipRegion(
DisplayListClipState::AutoSaveRestore& aClipState, nsIFrame* aFrame,
const nsPoint& aToReferenceFrame, const nsStyleImageLayers::Layer& aLayer,
const nsRect& aBackgroundRect, bool aWillPaintBorder) {
const nsStyleImageLayers::Layer& aLayer, const nsRect& aBackgroundRect,
bool aWillPaintBorder) {
nsCSSRendering::ImageLayerClipState clip;
nsCSSRendering::GetImageLayerClip(
aLayer, aFrame, *aFrame->StyleBorder(), aBackgroundRect, aBackgroundRect,
@ -3864,8 +3864,6 @@ bool nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
bool willPaintBorder = aAllowWillPaintBorderOptimization && !isThemed &&
!hasInsetShadow && borderStyle->HasBorder();
nsPoint toRef = aBuilder->ToReferenceFrame(aFrame);
// An auxiliary list is necessary in case we have background blending; if that
// is the case, background items need to be wrapped by a blend container to
// isolate blending to the background
@ -3969,7 +3967,7 @@ bool nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
if (!aBuilder->IsForEventDelivery()) {
const nsStyleImageLayers::Layer& layer = bg->mImage.mLayers[i];
SetBackgroundClipRegion(clipState, aFrame, toRef, layer, bgRect,
SetBackgroundClipRegion(clipState, aFrame, layer, bgRect,
willPaintBorder);
}

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

@ -497,16 +497,17 @@ void nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// Create backgrounds items as needed for the column and column
// group that this cell occupies.
nsTableColFrame* col = backgrounds->GetColForIndex(ColIndex());
nsTableColGroupFrame* colGroup = col->GetTableColGroupFrame();
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
aBuilder, col, bgRect, backgrounds->ColBackgrounds(), false, nullptr,
col->GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(col), this);
col->GetRect() + colGroup->GetPosition() +
backgrounds->TableToReferenceFrame(),
this);
nsIFrame* colGroup = col->GetParent();
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
aBuilder, colGroup, bgRect, backgrounds->ColGroupBackgrounds(), false,
nullptr,
colGroup->GetRectRelativeToSelf() +
aBuilder->ToReferenceFrame(colGroup),
nullptr, colGroup->GetRect() + backgrounds->TableToReferenceFrame(),
this);
}
}