Bug 480888 patch 3: Refactor a common pattern into a FrameMaintainsOverflow helper function. r=roc

This commit is contained in:
L. David Baron 2014-02-14 21:29:13 -08:00
parent 56df9ce565
commit 7ed7e8ed86

View File

@ -5133,11 +5133,18 @@ nsIFrame::GetPreEffectsVisualOverflowRect() const
return r ? *r : GetVisualOverflowRectRelativeToSelf();
}
inline static bool
FrameMaintainsOverflow(nsIFrame* aFrame)
{
return (aFrame->GetStateBits() &
(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY)) !=
(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
}
/* virtual */ bool
nsFrame::UpdateOverflow()
{
MOZ_ASSERT(!(mState & NS_FRAME_SVG_LAYOUT) ||
!(mState & NS_FRAME_IS_NONDISPLAY),
MOZ_ASSERT(FrameMaintainsOverflow(this),
"Non-display SVG do not maintain visual overflow rects");
nsRect rect(nsPoint(0, 0), GetSize());
@ -6851,8 +6858,7 @@ bool
nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
nsSize aNewSize, nsSize* aOldSize)
{
NS_ASSERTION(!((GetStateBits() & NS_FRAME_SVG_LAYOUT) &&
(GetStateBits() & NS_FRAME_IS_NONDISPLAY)),
NS_ASSERTION(FrameMaintainsOverflow(this),
"Don't call - overflow rects not maintained on these SVG frames");
nsRect bounds(nsPoint(0, 0), aNewSize);
@ -6997,8 +7003,7 @@ nsIFrame::RecomputePerspectiveChildrenOverflow(const nsStyleContext* aStartStyle
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* child = childFrames.get();
if ((child->GetStateBits() & NS_FRAME_SVG_LAYOUT) &&
(child->GetStateBits() & NS_FRAME_IS_NONDISPLAY)) {
if (!FrameMaintainsOverflow(child)) {
continue; // frame does not maintain overflow rects
}
if (child->HasPerspective()) {
@ -7047,8 +7052,7 @@ RecomputePreserve3DChildrenOverflow(nsIFrame* aFrame, const nsRect* aBounds)
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* child = childFrames.get();
if ((child->GetStateBits() & NS_FRAME_SVG_LAYOUT) &&
(child->GetStateBits() & NS_FRAME_IS_NONDISPLAY)) {
if (!FrameMaintainsOverflow(child)) {
continue; // frame does not maintain overflow rects
}
if (child->Preserves3DChildren()) {