Bug 745934. Update bounds of nsDisplayOpacity after we've mutated its list. r=mattwoodrow,a=blocking-fennec

This commit is contained in:
Robert O'Callahan 2012-04-19 14:40:43 +12:00
parent 483c294149
commit 23f723d5cc
6 changed files with 53 additions and 2 deletions

View File

@ -1573,14 +1573,14 @@ nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsDisplayList* aList)
: nsDisplayItem(aBuilder, aFrame) {
mList.AppendToTop(aList);
mBounds = mList.GetBounds(aBuilder);
UpdateBounds(aBuilder);
}
nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsDisplayItem* aItem)
: nsDisplayItem(aBuilder, aFrame) {
mList.AppendToTop(aItem);
mBounds = mList.GetBounds(aBuilder);
UpdateBounds(aBuilder);
}
nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder,

View File

@ -1744,6 +1744,13 @@ public:
nsDisplayWrapList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {}
virtual ~nsDisplayWrapList();
/**
* Call this if the wrapped list is changed.
*/
void UpdateBounds(nsDisplayListBuilder* aBuilder)
{
mBounds = mList.GetBounds(aBuilder);
}
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap);

View File

@ -1710,6 +1710,7 @@ WrapPreserve3DListInternal(nsIFrame* aFrame, nsDisplayListBuilder *aBuilder, nsD
}
nsDisplayOpacity *opacity = static_cast<nsDisplayOpacity*>(item);
rv = WrapPreserve3DListInternal(aFrame, aBuilder, opacity->GetList(), aIndex);
opacity->UpdateBounds(aBuilder);
newList.AppendToTop(item);
break;
}

View File

@ -0,0 +1,18 @@
<!DOCTYPE HTML>
<html>
<head>
<style>
div {
position: absolute;
top: 0; left: 0;
width: 600px;
height: 500px;
background: yellow;
opacity: 0.3;
}
</style>
</head>
<body>
<div></div>
</body>
</html>

View File

@ -0,0 +1,24 @@
<!DOCTYPE HTML>
<html>
<head>
<style>
div {
position: absolute;
top: 200px; left: 200px;
width: 600px;
height: 500px;
background: yellow;
opacity: 0.3;
-moz-transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
-moz-transform: translate(-200px, -200px);
-webkit-transform: translate(-200px, -200px);
transform: translate(-200px, -200px);
}
</style>
</head>
<body>
<div></div>
</body>
</html>

View File

@ -1699,3 +1699,4 @@ fuzzy-if(d2d,1,19) fuzzy-if(cocoaWidget,1,170) == 718521.html 718521-ref.html
== 731521-1.html 731521-1-ref.html
needs-focus == 731726-1.html 731726-1-ref.html
== 735481-1.html 735481-1-ref.html
== 745934-1.html 745934-1-ref.html