Bug 591435. Need to honour paint suppression in subdocuments. r=roc a=blocking beta6+

This commit is contained in:
Timothy Nikkel 2010-09-01 15:44:48 -05:00
Родитель 37f2ddc699
Коммит be242f5efb
3 изменённых файлов: 34 добавлений и 17 удалений

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

@ -74,6 +74,8 @@ 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),
@ -86,7 +88,6 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
nsPresContext* pc = aReferenceFrame->PresContext();
nsIPresShell *shell = pc->PresShell();
mIsBackgroundOnly = shell->IsPaintingSuppressed();
if (pc->IsRenderingOnlySelection()) {
nsCOMPtr<nsISelectionController> selcon(do_QueryInterface(shell));
if (selcon) {
@ -95,10 +96,6 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
}
}
if (mIsBackgroundOnly) {
mBuildCaret = PR_FALSE;
}
PR_STATIC_ASSERT(nsDisplayItem::TYPE_MAX < (1 << nsDisplayItem::TYPE_BITS));
}
@ -200,7 +197,18 @@ nsDisplayListBuilder::EnterPresShell(nsIFrame* aReferenceFrame,
state->mPresShell->IncrementPaintCount();
}
if (!mBuildCaret)
PRBool buildCaret = mBuildCaret;
if (mIgnoreSuppression || !state->mPresShell->IsPaintingSuppressed()) {
if (state->mPresShell->IsPaintingSuppressed()) {
mHadToIgnoreSuppression = PR_TRUE;
}
state->mIsBackgroundOnly = PR_FALSE;
} else {
state->mIsBackgroundOnly = PR_TRUE;
buildCaret = PR_FALSE;
}
if (!buildCaret)
return;
nsRefPtr<nsCaret> caret = state->mPresShell->GetCaret();

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

@ -148,12 +148,11 @@ public:
* @return PR_TRUE if "painting is suppressed" during page load and we
* should paint only the background of the document.
*/
PRBool IsBackgroundOnly() { return mIsBackgroundOnly; }
/**
* Set to PR_TRUE if painting should be suppressed during page load.
* Set to PR_FALSE if painting should not be suppressed.
*/
void SetBackgroundOnly(PRBool aIsBackgroundOnly) { mIsBackgroundOnly = aIsBackgroundOnly; }
PRBool IsBackgroundOnly() {
NS_ASSERTION(mPresShellStates.Length() > 0,
"don't call this if we're not in a presshell");
return CurrentPresShellState()->mIsBackgroundOnly;
}
/**
* @return PR_TRUE if the currently active BuildDisplayList call is being
* applied to a frame at the root of a pseudo stacking context. A pseudo
@ -213,7 +212,12 @@ 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; }
void IgnorePaintSuppression() { mIgnoreSuppression = PR_TRUE; }
/**
* @return Returns if this builder had to ignore painting suppression on some
* document when building the display list.
*/
PRBool GetHadToIgnorePaintSuppression() { return mHadToIgnoreSuppression; }
/**
* Call this if we're doing normal painting to the window.
*/
@ -368,6 +372,7 @@ private:
nsIPresShell* mPresShell;
nsIFrame* mCaretFrame;
PRUint32 mFirstFrameMarkedForDisplay;
PRPackedBool mIsBackgroundOnly;
};
PresShellState* CurrentPresShellState() {
NS_ASSERTION(mPresShellStates.Length() > 0,
@ -385,7 +390,8 @@ private:
nsDisplayTableItem* mCurrentTableItem;
PRPackedBool mBuildCaret;
PRPackedBool mEventDelivery;
PRPackedBool mIsBackgroundOnly;
PRPackedBool mIgnoreSuppression;
PRPackedBool mHadToIgnoreSuppression;
PRPackedBool mIsAtRootOfPseudoStackingContext;
PRPackedBool mSelectedFramesOnly;
PRPackedBool mAccurateVisibleRegions;

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

@ -1257,9 +1257,8 @@ nsLayoutUtils::PaintFrame(nsIRenderingContext* aRenderingContext, nsIFrame* aFra
if (aFlags & PAINT_WIDGET_LAYERS) {
builder.SetPaintingToWindow(PR_TRUE);
}
if ((aFlags & PAINT_IGNORE_SUPPRESSION) && builder.IsBackgroundOnly()) {
builder.SetBackgroundOnly(PR_FALSE);
willFlushLayers = PR_TRUE;
if (aFlags & PAINT_IGNORE_SUPPRESSION) {
builder.IgnorePaintSuppression();
}
nsRect canvasArea(nsPoint(0, 0), aFrame->GetSize());
if (aFlags & PAINT_IGNORE_VIEWPORT_SCROLLING) {
@ -1369,6 +1368,10 @@ 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",