Bug 1003425. When opacity is delegated to an nsDisplayBoxShadowOuter via nsDisplayItem::ApplyOpacity, store the opacity in our geometry so we can invalidate if it changes. r=mattwoodrow

--HG--
extra : rebase_source : f4b44bad8537029b0e03d912b927686aa352d681
This commit is contained in:
Robert O'Callahan 2014-07-22 01:59:10 +12:00
Родитель 87d6319a83
Коммит 37ae3ee79e
9 изменённых файлов: 93 добавлений и 17 удалений

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

@ -2807,11 +2807,12 @@ nsDisplayBoxShadowOuter::ComputeInvalidationRegion(nsDisplayListBuilder* aBuilde
const nsDisplayItemGeometry* aGeometry,
nsRegion* aInvalidRegion)
{
const nsDisplayItemGenericGeometry* geometry =
static_cast<const nsDisplayItemGenericGeometry*>(aGeometry);
const nsDisplayBoxShadowOuterGeometry* geometry =
static_cast<const nsDisplayBoxShadowOuterGeometry*>(aGeometry);
bool snap;
if (!geometry->mBounds.IsEqualInterior(GetBounds(aBuilder, &snap)) ||
!geometry->mBorderRect.IsEqualInterior(GetBorderRect())) {
!geometry->mBorderRect.IsEqualInterior(GetBorderRect()) ||
mOpacity != geometry->mOpacity) {
nsRegion oldShadow, newShadow;
nscoord dontCare[8];
bool hasBorderRadius = mFrame->GetBorderRadii(dontCare);

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

@ -2362,6 +2362,11 @@ public:
return true;
}
virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) MOZ_OVERRIDE
{
return new nsDisplayBoxShadowOuterGeometry(this, aBuilder, mOpacity);
}
nsRect GetBoundsInternal();
private:

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

@ -27,7 +27,7 @@ nsDisplayItemGenericGeometry::nsDisplayItemGenericGeometry(nsDisplayItem* aItem,
void
nsDisplayItemGenericGeometry::MoveBy(const nsPoint& aOffset)
{
mBounds.MoveBy(aOffset);
nsDisplayItemGeometry::MoveBy(aOffset);
mBorderRect.MoveBy(aOffset);
}
@ -38,12 +38,6 @@ nsDisplayItemBoundsGeometry::nsDisplayItemBoundsGeometry(nsDisplayItem* aItem, n
mHasRoundedCorners = aItem->Frame()->GetBorderRadii(radii);
}
void
nsDisplayItemBoundsGeometry::MoveBy(const nsPoint& aOffset)
{
mBounds.MoveBy(aOffset);
}
nsDisplayBorderGeometry::nsDisplayBorderGeometry(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder)
: nsDisplayItemGeometry(aItem, aBuilder)
, mContentRect(aItem->GetContentRect())
@ -52,7 +46,7 @@ nsDisplayBorderGeometry::nsDisplayBorderGeometry(nsDisplayItem* aItem, nsDisplay
void
nsDisplayBorderGeometry::MoveBy(const nsPoint& aOffset)
{
mBounds.MoveBy(aOffset);
nsDisplayItemGeometry::MoveBy(aOffset);
mContentRect.MoveBy(aOffset);
}
@ -65,7 +59,7 @@ nsDisplayBackgroundGeometry::nsDisplayBackgroundGeometry(nsDisplayBackgroundImag
void
nsDisplayBackgroundGeometry::MoveBy(const nsPoint& aOffset)
{
mBounds.MoveBy(aOffset);
nsDisplayItemGeometry::MoveBy(aOffset);
mPositioningArea.MoveBy(aOffset);
}
@ -79,7 +73,7 @@ nsDisplayThemedBackgroundGeometry::nsDisplayThemedBackgroundGeometry(nsDisplayTh
void
nsDisplayThemedBackgroundGeometry::MoveBy(const nsPoint& aOffset)
{
mBounds.MoveBy(aOffset);
nsDisplayItemGeometry::MoveBy(aOffset);
mPositioningArea.MoveBy(aOffset);
}
@ -91,7 +85,12 @@ nsDisplayBoxShadowInnerGeometry::nsDisplayBoxShadowInnerGeometry(nsDisplayItem*
void
nsDisplayBoxShadowInnerGeometry::MoveBy(const nsPoint& aOffset)
{
mBounds.MoveBy(aOffset);
nsDisplayItemGeometry::MoveBy(aOffset);
mPaddingRect.MoveBy(aOffset);
}
nsDisplayBoxShadowOuterGeometry::nsDisplayBoxShadowOuterGeometry(nsDisplayItem* aItem,
nsDisplayListBuilder* aBuilder, float aOpacity)
: nsDisplayItemGenericGeometry(aItem, aBuilder)
, mOpacity(aOpacity)
{}

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

@ -42,7 +42,10 @@ public:
*
* @param aOffset Offset to shift by.
*/
virtual void MoveBy(const nsPoint& aOffset) = 0;
virtual void MoveBy(const nsPoint& aOffset)
{
mBounds.MoveBy(aOffset);
}
/**
* Bounds of the display item
@ -71,8 +74,6 @@ class nsDisplayItemBoundsGeometry : public nsDisplayItemGeometry
public:
nsDisplayItemBoundsGeometry(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder);
virtual void MoveBy(const nsPoint& aOffset) MOZ_OVERRIDE;
bool mHasRoundedCorners;
};
@ -117,6 +118,16 @@ public:
nsRect mPaddingRect;
};
class nsDisplayBoxShadowOuterGeometry : public nsDisplayItemGenericGeometry
{
public:
nsDisplayBoxShadowOuterGeometry(nsDisplayItem* aItem,
nsDisplayListBuilder* aBuilder,
float aOpacity);
float mOpacity;
};
class nsDisplaySolidColorGeometry : public nsDisplayItemBoundsGeometry
{
public:

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

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<style>
div {
width: 500px;
height: 500px;
box-shadow: 0 0 40px #000;
}
</style>
<div id="d"></div>

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

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html class="reftest-wait">
<style>
div {
width: 500px;
height: 500px;
opacity: 0.5;
box-shadow: 0 0 40px #000;
}
</style>
<div id="d"></div>
<script>
function doTest() {
document.getElementById("d").style.opacity = 1;
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest);
</script>

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

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<style>
div {
width: 500px;
height: 500px;
background-color: lime;
}
</style>
<div id="d"></div>

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

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html class="reftest-wait">
<style>
div {
width: 500px;
height: 500px;
opacity: 0.5;
background-color: lime;
}
</style>
<div id="d"></div>
<script>
function doTest() {
document.getElementById("d").style.opacity = 1;
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest);
</script>

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

@ -1816,3 +1816,5 @@ pref(layout.css.will-change.enabled,true) == 1018522-1.html 1018522-1-ref.html
pref(browser.display.use_document_fonts,0) == 1022481-1.html 1022481-1-ref.html
== 1022612-1.html 1022612-1-ref.html
== 1024473-1.html 1024473-1-ref.html
== 1003425-1.html 1003425-1-ref.html
== 1003425-2.html 1003425-2-ref.html