Bug 577824 - Part 1. Set the frame size in nsIFrame::FinishAndStoreOverflow before the ComputeEffectsRect call that uses it. r=jwatt

This change ensures that HTML frames with SVG filters applied are given the
correct overflow regions so that they will display and invalidate correctly.

The bug that this commit fixes does not manifest in many cases since
often elements happen to be reflowed more than once when a document loads.
When that happened the bug would be masked because the filtered frame would be
given a size during the first reflow, and that would then make the overflow
calculations in subsequent reflows work.  It was only in cases where the
filtered frame was only reflowed once (such as when dynamically inserting a
filtered element into the DOM using script) that the lack of a valid frame
size during the overflow calculations would result in bad overflow regions
being calculated.

MozReview-Commit-ID: 79lR27KRSym

--HG--
extra : rebase_source : 9df6ff87002f0af4abf0b97e2a084902d81f468c
This commit is contained in:
cku 2017-08-09 01:04:49 +08:00
parent 73609ccb6b
commit eb978c416f

View File

@ -9055,6 +9055,20 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
ComputeAndIncludeOutlineArea(this, aOverflowAreas, aNewSize);
nsSize oldSize = mRect.Size();
bool sizeChanged = ((aOldSize ? *aOldSize : oldSize) != aNewSize);
// Our frame size may not have been computed and set yet, but code under
// functions such as ComputeEffectsRect (which we're about to call) use the
// values that are stored in our frame rect to compute their results. We
// need the results from those functions to be based on the frame size that
// we *will* have, so we temporarily set our frame size here before calling
// those functions.
//
// XXX Someone should document here why we revert the frame size before we
// return rather than just leaving it set.
SetSize(aNewSize);
// Nothing in here should affect scrollable overflow.
aOverflowAreas.VisualOverflow() =
ComputeEffectsRect(this, aOverflowAreas.VisualOverflow(), aNewSize);
@ -9071,15 +9085,6 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
}
/* If we're transformed, transform the overflow rect by the current transformation. */
nsSize oldSize = mRect.Size();
bool sizeChanged = ((aOldSize ? *aOldSize : oldSize) != aNewSize);
/* Since our size might not actually have been computed yet, we need to make sure that we use the
* correct dimensions by overriding the stored bounding rectangle with the value the caller has
* ensured us we'll use.
*/
SetSize(aNewSize);
if (ChildrenHavePerspective(disp) && sizeChanged) {
nsRect newBounds(nsPoint(0, 0), aNewSize);
RecomputePerspectiveChildrenOverflow(this, effectSet);