Bug 1216832 - Handle preserve-3d visible regions during display list building by always transforming from the preserve-3d root each time. r=roc

This commit is contained in:
Matt Woodrow 2016-02-12 00:18:55 +13:00
parent de19c25978
commit 73e1084a34
3 changed files with 11 additions and 25 deletions

View File

@ -966,12 +966,9 @@ nsDisplayListBuilder::MarkFramesForDisplayList(nsIFrame* aDirtyFrame,
* dirty rect for preserve-3d children.
*
* @param aDirtyFrame is the frame to mark children extending context.
* @param aDirtyRect is the same as the dirty rect of the root of the
* current 3D context, but be translated relative to
* the aDirtyFrame.
*/
void
nsDisplayListBuilder::MarkPreserve3DFramesForDisplayList(nsIFrame* aDirtyFrame, const nsRect& aDirtyRect)
nsDisplayListBuilder::MarkPreserve3DFramesForDisplayList(nsIFrame* aDirtyFrame)
{
AutoTArray<nsIFrame::ChildList,4> childListArray;
aDirtyFrame->GetChildLists(&childListArray);
@ -982,10 +979,6 @@ nsDisplayListBuilder::MarkPreserve3DFramesForDisplayList(nsIFrame* aDirtyFrame,
nsIFrame *child = childFrames.get();
if (child->Combines3DTransformWithAncestors()) {
mFramesMarkedForDisplay.AppendElement(child);
nsRect dirty = aDirtyRect - child->GetOffsetTo(aDirtyFrame);
child->Properties().Set(nsDisplayListBuilder::Preserve3DDirtyRectProperty(),
new nsRect(dirty));
MarkFrameForDisplay(child, aDirtyFrame);
}
}

View File

@ -575,7 +575,7 @@ public:
* Because these frames include transforms set on their parent, dirty rects
* for intermediate frames may be empty, yet child frames could still be visible.
*/
void MarkPreserve3DFramesForDisplayList(nsIFrame* aDirtyFrame, const nsRect& aDirtyRect);
void MarkPreserve3DFramesForDisplayList(nsIFrame* aDirtyFrame);
const nsTArray<ThemeGeometry>& GetThemeGeometries() { return mThemeGeometries; }
@ -968,8 +968,6 @@ public:
aFrame->Properties().Get(OutOfFlowDisplayDataProperty()));
}
NS_DECLARE_FRAME_PROPERTY_DELETABLE(Preserve3DDirtyRectProperty, nsRect)
nsPresContext* CurrentPresContext() {
return CurrentPresShellState()->mPresShell->GetPresContext();
}

View File

@ -2051,8 +2051,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
nsRect dirtyRectOutsideTransform = dirtyRect;
if (isTransformed) {
const nsRect overflow = GetVisualOverflowRectRelativeToSelf();
if (Extend3DContext() || Combines3DTransformWithAncestors() ||
nsDisplayTransform::ShouldPrerenderTransformedContent(aBuilder,
if (nsDisplayTransform::ShouldPrerenderTransformedContent(aBuilder,
this)) {
dirtyRect = overflow;
} else {
@ -2060,9 +2059,15 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
return;
}
// 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()) {
dirtyRect = aBuilder->GetPreserves3DDirtyRect(this);
}
nsRect untransformedDirtyRect;
if (nsDisplayTransform::UntransformRect(dirtyRect, overflow, this,
nsPoint(0,0), &untransformedDirtyRect, false)) {
nsPoint(0,0), &untransformedDirtyRect, true)) {
dirtyRect = untransformedDirtyRect;
} else {
NS_WARNING("Unable to untransform dirty rect!");
@ -2134,8 +2139,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
// Extend3DContext() also guarantees that applyAbsPosClipping and usingSVGEffects are false
// We only modify the preserve-3d rect if we are the top of a preserve-3d heirarchy
if (Extend3DContext()) {
nsRect dirty = aBuilder->GetPreserves3DDirtyRect(this);
aBuilder->MarkPreserve3DFramesForDisplayList(this, dirty);
aBuilder->MarkPreserve3DFramesForDisplayList(this);
}
if (aBuilder->IsBuildingLayerEventRegions()) {
@ -2462,15 +2466,6 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
}
pseudoStackingContext = true;
}
if (child->Combines3DTransformWithAncestors()) {
nsRect* savedDirty = static_cast<nsRect*>
(child->Properties().Get(nsDisplayListBuilder::Preserve3DDirtyRectProperty()));
if (savedDirty) {
dirty = *savedDirty;
} else {
dirty.SetEmpty();
}
}
NS_ASSERTION(childType != nsGkAtoms::placeholderFrame,
"Should have dealt with placeholders already");