Bug 1098266. Set correct visible rect on nsDisplayOpacity items that are shuffled around during preserve-3d display list wrapping. r=tn

This commit is contained in:
Robert O'Callahan 2014-11-24 14:03:49 +13:00
parent ede2626f13
commit 1d690099cd
5 changed files with 32 additions and 0 deletions

View File

@ -3482,6 +3482,13 @@ nsDisplayWrapList::SetVisibleRect(const nsRect& aRect)
mVisibleRect = aRect;
}
void
nsDisplayWrapList::SetReferenceFrame(const nsIFrame* aFrame)
{
mReferenceFrame = aFrame;
mToReferenceFrame = mFrame->GetOffsetToCrossDoc(mReferenceFrame);
}
static nsresult
WrapDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayList* aList, nsDisplayWrapper* aWrapper) {

View File

@ -2743,6 +2743,8 @@ public:
void SetVisibleRect(const nsRect& aRect);
void SetReferenceFrame(const nsIFrame* aFrame);
/**
* This creates a copy of this item, but wrapping aItem instead of
* our existing list. Only gets called if this item returned nullptr

View File

@ -1796,6 +1796,7 @@ WrapPreserve3DListInternal(nsIFrame* aFrame, nsDisplayListBuilder *aBuilder,
switch (item->GetType()) {
case nsDisplayItem::TYPE_TRANSFORM: {
if (!aTemp->IsEmpty()) {
// Flush current aTemp contents
aOutput->AppendToTop(new (aBuilder) nsDisplayTransform(aBuilder,
aFrame, aTemp, aTemp->GetVisibleRect(), aIndex++));
}
@ -1819,6 +1820,7 @@ WrapPreserve3DListInternal(nsIFrame* aFrame, nsDisplayListBuilder *aBuilder,
}
case nsDisplayItem::TYPE_OPACITY: {
if (!aTemp->IsEmpty()) {
// Flush current aTemp contents
aOutput->AppendToTop(new (aBuilder) nsDisplayTransform(aBuilder,
aFrame, aTemp, aTemp->GetVisibleRect(), aIndex++));
}
@ -1833,6 +1835,9 @@ WrapPreserve3DListInternal(nsIFrame* aFrame, nsDisplayListBuilder *aBuilder,
output.AppendToTop(new (aBuilder) nsDisplayTransform(aBuilder,
aFrame, aTemp, aTemp->GetVisibleRect(), aIndex++));
}
opacity->SetVisibleRect(output.GetVisibleRect());
opacity->SetReferenceFrame(output.GetBottom()->ReferenceFrame());
opacity->GetChildren()->AppendToTop(&output);
opacity->UpdateBounds(aBuilder);
aOutput->AppendToTop(item);

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<body>
<div style="position: absolute; transform-style: preserve-3d; transform: perspective(600px) scale(0.166667); opacity:0.3">
<div style="position: absolute; background: yellow; width:900px; height:100px; transform: translate3d(0, 3000px, 0px) rotateZ(90deg) scale(5); transform-style: preserve-3d;">
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<body>
<div style="position: absolute; transform-style: preserve-3d; transform: perspective(600px) scale(0.166667); ">
<div style="position: absolute; background: yellow; width:900px; height:100px; transform: translate3d(0, 3000px, 0px) rotateZ(90deg) scale(5); transform-style: preserve-3d; opacity:0.3">
</div>
</div>
</body>
</html>