diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 59467d55535..3e21088046d 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -74,8 +74,6 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame, mCurrentTableItem(nsnull), mBuildCaret(aBuildCaret), mEventDelivery(aIsForEvents), - mIgnoreSuppression(PR_FALSE), - mHadToIgnoreSuppression(PR_FALSE), mIsAtRootOfPseudoStackingContext(PR_FALSE), mSelectedFramesOnly(PR_FALSE), mAccurateVisibleRegions(PR_FALSE), @@ -289,25 +287,9 @@ nsDisplayList::GetBounds(nsDisplayListBuilder* aBuilder) const { } PRBool -nsDisplayList::ComputeVisibilityForRoot(nsDisplayListBuilder* aBuilder, - nsRegion* aVisibleRegion) { - NS_ASSERTION(aBuilder->ReferenceFrame()->GetOverflowRect().Contains(aVisibleRegion->GetBounds()), - "aVisibleRegion out of bounds"); - return ComputeVisibilityForSublist(aBuilder, aVisibleRegion, - aVisibleRegion->GetBounds()); -} - -PRBool -nsDisplayList::ComputeVisibilityForSublist(nsDisplayListBuilder* aBuilder, - nsRegion* aVisibleRegion, - const nsRect& aListVisibleBounds) { -#ifdef DEBUG - nsRegion r; - r.And(*aVisibleRegion, GetBounds(aBuilder)); - NS_ASSERTION(r.GetBounds() == aListVisibleBounds, - "bad aListVisibleBounds"); -#endif - mVisibleRect = aListVisibleBounds; +nsDisplayList::ComputeVisibility(nsDisplayListBuilder* aBuilder, + nsRegion* aVisibleRegion) { + mVisibleRect = aVisibleRegion->GetBounds(); PRBool anyVisible = PR_FALSE; nsAutoTArray elements; @@ -340,7 +322,7 @@ nsDisplayList::ComputeVisibilityForSublist(nsDisplayListBuilder* aBuilder, AppendToBottom(item); } - mIsOpaque = !aVisibleRegion->Intersects(mVisibleRect); + mIsOpaque = aVisibleRegion->IsEmpty(); #ifdef DEBUG mDidComputeVisibility = PR_TRUE; #endif @@ -1073,13 +1055,14 @@ nsDisplayWrapList::GetBounds(nsDisplayListBuilder* aBuilder) { PRBool nsDisplayWrapList::ComputeVisibility(nsDisplayListBuilder* aBuilder, nsRegion* aVisibleRegion) { - return mList.ComputeVisibilityForSublist(aBuilder, aVisibleRegion, - mVisibleRect); + return mList.ComputeVisibility(aBuilder, aVisibleRegion); } PRBool nsDisplayWrapList::IsOpaque(nsDisplayListBuilder* aBuilder) { - return mList.IsOpaque(); + // We could try to do something but let's conservatively just return PR_FALSE. + // We reimplement ComputeVisibility and that's what really matters + return PR_FALSE; } PRBool nsDisplayWrapList::IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor) { @@ -1401,11 +1384,8 @@ PRBool nsDisplayZoom::ComputeVisibility(nsDisplayListBuilder *aBuilder, aVisibleRegion->ConvertAppUnitsRoundOut(mParentAPD, mAPD); nsRegion originalVisibleRegion = visibleRegion; - nsRect transformedVisibleRect = - mVisibleRect.ConvertAppUnitsRoundOut(mParentAPD, mAPD); PRBool retval = - mList.ComputeVisibilityForSublist(aBuilder, &visibleRegion, - transformedVisibleRect); + nsDisplayWrapList::ComputeVisibility(aBuilder, &visibleRegion); nsRegion removed; // removed = originalVisibleRegion - visibleRegion diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 6735155c0fc..fb6985edb30 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -213,25 +213,7 @@ public: * Allows callers to selectively override the regular paint suppression checks, * so that methods like GetFrameForPoint work when painting is suppressed. */ - void IgnorePaintSuppression() { - mIsBackgroundOnly = PR_FALSE; - mIgnoreSuppression = PR_TRUE; - } - /** - * @return PR_TRUE if this builder is set to ignore painting suppression in - * all documents. - */ - PRBool IsIgnoringPaintSuppression() { return mIgnoreSuppression; } - /** - * @return Call this if we ignore painting suppression on some document when - * using this builder to build a display list. - */ - void SetHadToIgnorePaintSuppression() { mHadToIgnoreSuppression = PR_TRUE; } - /** - * @return Returns if this builder had to ignore painting suppression on some - * document when when building the display list. - */ - PRBool GetHadToIgnorePaintSuppression() { return mHadToIgnoreSuppression; } + void IgnorePaintSuppression() { mIsBackgroundOnly = PR_FALSE; } /** * Call this if we're doing normal painting to the window. */ @@ -404,8 +386,6 @@ private: PRPackedBool mBuildCaret; PRPackedBool mEventDelivery; PRPackedBool mIsBackgroundOnly; - PRPackedBool mIgnoreSuppression; - PRPackedBool mHadToIgnoreSuppression; PRPackedBool mIsAtRootOfPseudoStackingContext; PRPackedBool mSelectedFramesOnly; PRPackedBool mAccurateVisibleRegions; @@ -862,34 +842,17 @@ public: * This is also a good place to put ComputeVisibility-related logic * that must be applied to every display item. In particular, this * sets mVisibleRect on each display item. - * This sets mIsOpaque if the entire visible area of this list has - * been removed from aVisibleRegion when we return. + * This also sets mIsOpaque to whether aVisibleRegion is empty on return. * This does not remove any items from the list, so we can recompute * visiblity with different regions later (see * FrameLayerBuilder::DrawThebesLayer). * * @param aVisibleRegion the area that is visible, relative to the - * reference frame; on return, this contains the area visible under the list. - * I.e., opaque contents of this list are subtracted from aVisibleRegion. - * @param aListVisibleBounds must be equal to the bounds of the intersection - * of aVisibleRegion and GetBounds() for this list. + * reference frame; on return, this contains the area visible under the list * @return true if any item in the list is visible */ - PRBool ComputeVisibilityForSublist(nsDisplayListBuilder* aBuilder, - nsRegion* aVisibleRegion, - const nsRect& aListVisibleBounds); - - /** - * As ComputeVisibility, but computes visibility for a sublist. - * aListVisibleBounds is a rectangle that's the bounds of the - * intersection of thisitem's GetBounds with aVisibleRegion. - * - * @param aVisibleRegion the area that is visible; on entry this must - * not extend outside the overflow area of the reference frame. - */ - PRBool ComputeVisibilityForRoot(nsDisplayListBuilder* aBuilder, - nsRegion* aVisibleRegion); - + PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, + nsRegion* aVisibleRegion); /** * Returns true if the visible region output from ComputeVisiblity was * empty, i.e. everything visible in this list is opaque. diff --git a/layout/base/nsLayoutDebugger.cpp b/layout/base/nsLayoutDebugger.cpp index 60c1d8bf69c..fa08840283b 100644 --- a/layout/base/nsLayoutDebugger.cpp +++ b/layout/base/nsLayoutDebugger.cpp @@ -176,13 +176,13 @@ PrintDisplayListTo(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList, } nscolor color; nsRect vis = i->GetVisibleRect(); - nsDisplayList* list = i->GetList(); fprintf(aOutput, "%s %p(%s) (%d,%d,%d,%d)(%d,%d,%d,%d)%s%s\n", i->Name(), (void*)f, NS_ConvertUTF16toUTF8(fName).get(), rect.x, rect.y, rect.width, rect.height, vis.x, vis.y, vis.width, vis.height, - ((!list || list->DidComputeVisibility()) && i->IsOpaque(aBuilder)) ? " opaque" : "", + i->IsOpaque(aBuilder) ? " opaque" : "", i->IsUniform(aBuilder, &color) ? " uniform" : ""); + nsDisplayList* list = i->GetList(); if (list) { PrintDisplayListTo(aBuilder, *list, aIndent + 4, aOutput); } diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index aa2996e26ad..867148057dc 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -1369,10 +1369,6 @@ nsLayoutUtils::PaintFrame(nsIRenderingContext* aRenderingContext, nsIFrame* aFra builder.LeavePresShell(aFrame, dirtyRect); NS_ENSURE_SUCCESS(rv, rv); - if (builder.GetHadToIgnorePaintSuppression()) { - willFlushLayers = PR_TRUE; - } - #ifdef DEBUG if (gDumpPaintList) { fprintf(stderr, "Painting --- before optimization (dirty %d,%d,%d,%d):\n", @@ -1381,7 +1377,7 @@ nsLayoutUtils::PaintFrame(nsIRenderingContext* aRenderingContext, nsIFrame* aFra } #endif - list.ComputeVisibilityForRoot(&builder, &visibleRegion); + list.ComputeVisibility(&builder, &visibleRegion); #ifdef DEBUG if (gDumpPaintList) { diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 9c456d693de..85d8e3f70cc 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -2536,7 +2536,7 @@ nsRootPresContext::GetPluginGeometryUpdates(nsIFrame* aChangedSubtree, #endif nsRegion visibleRegion(bounds); - list.ComputeVisibilityForRoot(&builder, &visibleRegion); + list.ComputeVisibility(&builder, &visibleRegion); #ifdef DEBUG if (gDumpPluginList) { diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 3803e4d66a5..58151804b14 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -5618,7 +5618,7 @@ PresShell::PaintRangePaintInfo(nsTArray >* aItems, aArea.MoveBy(-rangeInfo->mRootOffset.x, -rangeInfo->mRootOffset.y); nsRegion visible(aArea); - rangeInfo->mList.ComputeVisibilityForRoot(&rangeInfo->mBuilder, &visible); + rangeInfo->mList.ComputeVisibility(&rangeInfo->mBuilder, &visible); rangeInfo->mList.PaintRoot(&rangeInfo->mBuilder, rc, nsDisplayList::PAINT_DEFAULT); aArea.MoveBy(rangeInfo->mRootOffset.x, rangeInfo->mRootOffset.y); } diff --git a/layout/generic/nsFrameFrame.cpp b/layout/generic/nsFrameFrame.cpp index bf9a2f879e3..3cad0cd3aeb 100644 --- a/layout/generic/nsFrameFrame.cpp +++ b/layout/generic/nsFrameFrame.cpp @@ -454,18 +454,8 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, GetOffsetToCrossDoc(aBuilder->ReferenceFrame()); if (subdocRootFrame && NS_SUCCEEDED(rv)) { - PRBool save = aBuilder->IsBackgroundOnly(); - if (presShell->IsPaintingSuppressed() && - aBuilder->IsIgnoringPaintSuppression()) { - aBuilder->SetHadToIgnorePaintSuppression(); - } - if (presShell->IsPaintingSuppressed() && - !aBuilder->IsIgnoringPaintSuppression()) { - aBuilder->SetBackgroundOnly(PR_TRUE); - } rv = subdocRootFrame-> BuildDisplayListForStackingContext(aBuilder, dirty, &childItems); - aBuilder->SetBackgroundOnly(save); } if (!aBuilder->IsForEventDelivery()) { diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 6893b19aee3..b08057bf2e5 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -1568,7 +1568,7 @@ InvalidateFixedBackgroundFrames(nsIFrame* aRootFrame, return; nsRegion visibleRegion(aUpdateRect); - list.ComputeVisibilityForRoot(&builder, &visibleRegion); + list.ComputeVisibility(&builder, &visibleRegion); InvalidateFixedBackgroundFramesFromList(&builder, aMovingFrame, list); list.DeleteAll();