Bug 802628 - Part 2, Fix broken invalidation in ReflowSVG implementations. r=mattwoodrow.

This commit is contained in:
Jonathan Watt 2012-11-28 10:34:58 +00:00
parent f595fb2060
commit 29110f1969
6 changed files with 13 additions and 79 deletions

View File

@ -300,26 +300,12 @@ nsSVGDisplayContainerFrame::ReflowSVG()
nsSVGEffects::UpdateEffects(this);
}
// We only invalidate if we are dirty, if our outer-<svg> has already had its
// initial reflow (since if it hasn't, its entire area will be invalidated
// when it gets that initial reflow), and if our parent is not dirty (since
// if it is, then it will invalidate its entire new area, which will include
// our new area).
bool invalidate = (mState & NS_FRAME_IS_DIRTY) &&
!(GetParent()->GetStateBits() &
(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY));
FinishAndStoreOverflow(overflowRects, mRect.Size());
// Remove state bits after FinishAndStoreOverflow so that it doesn't
// invalidate on first reflow:
mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
if (invalidate) {
// XXXSDL Let FinishAndStoreOverflow do this.
nsSVGUtils::InvalidateBounds(this, true);
}
}
void

View File

@ -411,15 +411,6 @@ nsSVGForeignObjectFrame::ReflowSVG()
nsSVGEffects::UpdateEffects(this);
}
// We only invalidate if we are dirty, if our outer-<svg> has already had its
// initial reflow (since if it hasn't, its entire area will be invalidated
// when it gets that initial reflow), and if our parent is not dirty (since
// if it is, then it will invalidate its entire new area, which will include
// our new area).
bool invalidate = (mState & NS_FRAME_IS_DIRTY) &&
!(GetParent()->GetStateBits() &
(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY));
// TODO: once we support |overflow:visible| on foreignObject, then we will
// need to take account of our descendants here.
nsRect overflow = nsRect(nsPoint(0,0), mRect.Size());
@ -429,11 +420,6 @@ nsSVGForeignObjectFrame::ReflowSVG()
// Now unset the various reflow bits:
mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
if (invalidate) {
// XXXSDL Let FinishAndStoreOverflow do this.
nsSVGUtils::InvalidateBounds(this, true);
}
}
void

View File

@ -541,15 +541,6 @@ nsSVGGlyphFrame::ReflowSVG()
PresContext()->AppUnitsPerCSSPixel());
}
// We only invalidate if we are dirty, if our outer-<svg> has already had its
// initial reflow (since if it hasn't, its entire area will be invalidated
// when it gets that initial reflow), and if our parent is not dirty (since
// if it is, then it will invalidate its entire new area, which will include
// our new area).
bool invalidate = (mState & NS_FRAME_IS_DIRTY) &&
!(GetParent()->GetStateBits() &
(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY));
nsRect overflow = nsRect(nsPoint(0,0), mRect.Size());
nsOverflowAreas overflowAreas(overflow, overflow);
FinishAndStoreOverflow(overflowAreas, mRect.Size());
@ -557,11 +548,12 @@ nsSVGGlyphFrame::ReflowSVG()
mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
if (invalidate) {
// XXXSDL Let FinishAndStoreOverflow do this.
nsSVGUtils::InvalidateBounds(this, true);
// Invalidate, but only if this is not our first reflow (since if it is our
// first reflow then we haven't had our first paint yet).
if (!(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
InvalidateFrame();
}
}
}
void
nsSVGGlyphFrame::NotifySVGChanged(uint32_t aFlags)

View File

@ -488,15 +488,6 @@ nsSVGImageFrame::ReflowSVG()
nsSVGEffects::UpdateEffects(this);
}
// We only invalidate if we are dirty, if our outer-<svg> has already had its
// initial reflow (since if it hasn't, its entire area will be invalidated
// when it gets that initial reflow), and if our parent is not dirty (since
// if it is, then it will invalidate its entire new area, which will include
// our new area).
bool invalidate = (mState & NS_FRAME_IS_DIRTY) &&
!(GetParent()->GetStateBits() &
(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY));
nsRect overflow = nsRect(nsPoint(0,0), mRect.Size());
nsOverflowAreas overflowAreas(overflow, overflow);
FinishAndStoreOverflow(overflowAreas, mRect.Size());
@ -504,9 +495,10 @@ nsSVGImageFrame::ReflowSVG()
mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
if (invalidate) {
// XXXSDL Let FinishAndStoreOverflow do this.
nsSVGUtils::InvalidateBounds(this, true);
// Invalidate, but only if this is not our first reflow (since if it is our
// first reflow then we haven't had our first paint yet).
if (!(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
InvalidateFrame();
}
}

View File

@ -320,15 +320,6 @@ nsSVGPathGeometryFrame::ReflowSVG()
nsSVGEffects::UpdateEffects(this);
}
// We only invalidate if we are dirty, if our outer-<svg> has already had its
// initial reflow (since if it hasn't, its entire area will be invalidated
// when it gets that initial reflow), and if our parent is not dirty (since
// if it is, then it will invalidate its entire new area, which will include
// our new area).
bool invalidate = (mState & NS_FRAME_IS_DIRTY) &&
!(GetParent()->GetStateBits() &
(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY));
nsRect overflow = nsRect(nsPoint(0,0), mRect.Size());
nsOverflowAreas overflowAreas(overflow, overflow);
FinishAndStoreOverflow(overflowAreas, mRect.Size());
@ -336,9 +327,10 @@ nsSVGPathGeometryFrame::ReflowSVG()
mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
if (invalidate) {
// XXXSDL Let FinishAndStoreOverflow do this.
nsSVGUtils::InvalidateBounds(this, true);
// Invalidate, but only if this is not our first reflow (since if it is our
// first reflow then we haven't had our first paint yet).
if (!(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
InvalidateFrame();
}
}

View File

@ -210,26 +210,12 @@ nsSVGSwitchFrame::ReflowSVG()
nsSVGEffects::UpdateEffects(this);
}
// We only invalidate if we are dirty, if our outer-<svg> has already had its
// initial reflow (since if it hasn't, its entire area will be invalidated
// when it gets that initial reflow), and if our parent is not dirty (since
// if it is, then it will invalidate its entire new area, which will include
// our new area).
bool invalidate = (mState & NS_FRAME_IS_DIRTY) &&
!(GetParent()->GetStateBits() &
(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY));
FinishAndStoreOverflow(overflowRects, mRect.Size());
// Remove state bits after FinishAndStoreOverflow so that it doesn't
// invalidate on first reflow:
mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
if (invalidate) {
// XXXSDL Let FinishAndStoreOverflow do this.
nsSVGUtils::InvalidateBounds(this, true);
}
}
SVGBBox