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

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

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