Bug 1441796 - Part 3: Reuse the results in nsIFrame::BuildDisplayListForStackingContext() for ChildrenHavePerspective(), IsTransformed(), and Combines3DTransformWithAncestors() r=mattwoodrow

MozReview-Commit-ID: J2PtZDMbHh2

--HG--
extra : rebase_source : be988df9ed220fea143aa35e463c2d3a85a2d799
This commit is contained in:
Miko Mynttinen 2018-03-27 14:18:27 +02:00
Родитель 8a6f19946e
Коммит 8ffa5ed1e3
2 изменённых файлов: 15 добавлений и 11 удалений

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

@ -2826,9 +2826,15 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
nsRect visibleRect = aBuilder->GetVisibleRect();
nsRect dirtyRect = aBuilder->GetDirtyRect();
bool extend3DContext = Extend3DContext(disp, effectSet);
const bool isTransformed = IsTransformed(disp);
const bool hasPerspective = isTransformed && HasPerspective(disp);
const bool extend3DContext = Extend3DContext(disp, effectSet);
const bool combines3DTransformWithAncestors =
(extend3DContext || isTransformed) && Combines3DTransformWithAncestors(disp);
const bool childrenHavePerspective = ChildrenHavePerspective(disp);
Maybe<nsDisplayListBuilder::AutoPreserves3DContext> autoPreserves3DContext;
if (extend3DContext && !Combines3DTransformWithAncestors(disp)) {
if (extend3DContext && !combines3DTransformWithAncestors) {
// Start a new preserves3d context to keep informations on
// nsDisplayListBuilder.
autoPreserves3DContext.emplace(aBuilder);
@ -2848,15 +2854,11 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
// We need to make sure we build all of them for them to be consistent, so
// rebuild all items if we have perspective. Bug 1431249 should remove
// this requirement.
if (aBuilder->IsRetainingDisplayList() &&
ChildrenHavePerspective(disp)) {
if (aBuilder->IsRetainingDisplayList() && childrenHavePerspective) {
dirtyRect = visibleRect;
aBuilder->MarkFrameModifiedDuringBuilding(this);
}
bool inTransform = aBuilder->IsInTransform();
bool isTransformed = IsTransformed(disp);
bool hasPerspective = HasPerspective(disp);
// reset blend mode so we can keep track if this stacking context needs have
// a nsDisplayBlendContainer. Set the blend mode back when the routine exits
// so we keep track if the parent stacking context needs a container too.
@ -2865,6 +2867,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
nsRect visibleRectOutsideTransform = visibleRect;
bool allowAsyncAnimation = false;
bool inTransform = aBuilder->IsInTransform();
if (isTransformed) {
const nsRect overflow = GetVisualOverflowRectRelativeToSelf();
nsDisplayTransform::PrerenderDecision decision =
@ -2886,7 +2889,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
// If we're in preserve-3d then grab the dirty rect that was given to the root
// and transform using the combined transform.
if (Combines3DTransformWithAncestors(disp)) {
if (combines3DTransformWithAncestors) {
visibleRect = dirtyRect = aBuilder->GetPreserves3DRect();
}
@ -3025,7 +3028,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
nsDisplayListBuilder::AutoInTransformSetter
inTransformSetter(aBuilder, inTransform);
nsDisplayListBuilder::AutoSaveRestorePerspectiveIndex
perspectiveIndex(aBuilder, this);
perspectiveIndex(aBuilder, childrenHavePerspective);
nsDisplayListBuilder::AutoFilterASRSetter
filterASRSetter(aBuilder, usingFilter);

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

@ -1182,10 +1182,11 @@ public:
class AutoSaveRestorePerspectiveIndex {
public:
AutoSaveRestorePerspectiveIndex(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
AutoSaveRestorePerspectiveIndex(nsDisplayListBuilder* aBuilder,
const bool aChildrenHavePerspective)
: mBuilder(nullptr)
{
if (aFrame->ChildrenHavePerspective()) {
if (aChildrenHavePerspective) {
mBuilder = aBuilder;
mCachedItemIndex = aBuilder->mPerspectiveItemIndex;
aBuilder->mPerspectiveItemIndex = 0;