Backout bug 485275 (changeset 996c11579453) because of test failures

This commit is contained in:
Dão Gottwald 2009-04-18 10:53:27 +02:00
Родитель d746f2250f
Коммит b3521097f8
7 изменённых файлов: 52 добавлений и 129 удалений

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

@ -982,7 +982,9 @@ nsCSSRendering::FindRootFrame(nsIFrame* aForFrame)
*
* |FindBackground| returns true if a background should be painted, and
* the resulting style context to use for the background information
* will be filled in to |aBackground|.
* will be filled in to |aBackground|. It fills in a boolean indicating
* whether the frame is the canvas frame, because PaintBackground must
* propagate that frame's background color to the view manager.
*/
const nsStyleBackground*
nsCSSRendering::FindRootFrameBackground(nsIFrame* aForFrame)

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

@ -171,8 +171,6 @@ nsDisplayListBuilder::EnterPresShell(nsIFrame* aReferenceFrame,
state->mCaretFrame = nsnull;
state->mFirstFrameMarkedForDisplay = mFramesMarkedForDisplay.Length();
state->mPresShell->UpdateCanvasBackground();
if (!mBuildCaret)
return;
@ -194,7 +192,8 @@ nsDisplayListBuilder::EnterPresShell(nsIFrame* aReferenceFrame,
void
nsDisplayListBuilder::LeavePresShell(nsIFrame* aReferenceFrame,
const nsRect& aDirtyRect) {
const nsRect& aDirtyRect)
{
if (CurrentPresShellState()->mPresShell != aReferenceFrame->PresContext()->PresShell()) {
// Must have not allocated a state for this presshell, presumably due
// to OOM.
@ -255,7 +254,7 @@ nsDisplayItem::OptimizeVisibility(nsDisplayListBuilder* aBuilder,
if (isMoving) {
// The display list should include items for both the before and after
// states (see nsLayoutUtils::ComputeRepaintRegionForCopy. So the
// only area we want to cover is the area that was opaque in the
// only area we want to cover is the the area that was opaque in the
// before state and in the after state.
opaqueArea.IntersectRect(bounds - aBuilder->GetMoveDelta(), bounds);
}
@ -492,30 +491,6 @@ void nsDisplayList::Sort(nsDisplayListBuilder* aBuilder,
::Sort(this, Count(), aCmp, aClosure);
}
void nsDisplaySolidColor::Paint(nsDisplayListBuilder* aBuilder,
nsIRenderingContext* aCtx, const nsRect& aDirtyRect) {
nsRect dirty;
dirty.IntersectRect(GetBounds(aBuilder), aDirtyRect);
aCtx->SetColor(mColor);
aCtx->FillRect(dirty);
}
// Even though we aren't supposed to, we need to override this because
// we have no frame.
PRBool
nsDisplaySolidColor::OptimizeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) {
// Do what nsDisplayItem::OptimizeVisibility would do but without a frame.
if (!aVisibleRegion->Intersects(mBounds))
return PR_FALSE;
if (IsOpaque(aBuilder)) {
aVisibleRegion->SimpleSubtract(mBounds);
}
return PR_TRUE;
}
PRBool
nsDisplayBackground::IsOpaque(nsDisplayListBuilder* aBuilder) {
// theme background overrides any other background

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

@ -1007,45 +1007,6 @@ public:
NS_DISPLAY_DECL_NAME("Border")
};
/**
* A simple display item that just renders a solid color across a frame or
* specified bounds. Used in cases where we can't draw the frame tree but
* we want to draw something to avoid an ugly flash of white when
* navigating between pages. Also used as a bottom item to ensure that
* something is painted everywhere.
*/
class nsDisplaySolidColor : public nsDisplayItem {
public:
nsDisplaySolidColor(const nsRect& aBounds, nscolor aColor)
: nsDisplayItem(nsnull), mBounds(aBounds), mColor(aColor) {
MOZ_COUNT_CTOR(nsDisplaySolidColor);
}
#ifdef NS_BUILD_REFCNT_LOGGING
virtual ~nsDisplaySolidColor() {
MOZ_COUNT_DTOR(nsDisplaySolidColor);
}
#endif
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder) { return mBounds; }
virtual PRBool IsOpaque(nsDisplayListBuilder* aBuilder) {
return (NS_GET_A(mColor) == 255);
}
virtual PRBool IsUniform(nsDisplayListBuilder* aBuilder) { return PR_TRUE; }
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx,
const nsRect& aDirtyRect);
virtual PRBool OptimizeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion);
NS_DISPLAY_DECL_NAME("SolidColor")
private:
nsRect mBounds;
nscolor mColor;
};
/**
* The standard display item to paint the CSS background of a frame.
*/

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

@ -101,10 +101,10 @@ class nsPIDOMEventTarget;
typedef short SelectionType;
typedef PRUint32 nsFrameState;
// fa1bf801-9fb6-4d19-8d33-698e9961fc10
// fa7f090d-b19a-4ef8-9552-82992a3b4a83
#define NS_IPRESSHELL_IID \
{ 0xfa1bf801, 0x9fb6, 0x4d19, \
{ 0x8d, 0x33, 0x69, 0x8e, 0x99, 0x61, 0xfc, 0x10 } }
{ 0xfa7f090d, 0xb19a, 0x4ef8, \
{ 0x95, 0x52, 0x82, 0x99, 0x2a, 0x3b, 0x4a, 0x83 } }
// Constants for ScrollContentIntoView() function
#define NS_PRESSHELL_SCROLL_TOP 0
@ -793,11 +793,6 @@ public:
void SetCanvasBackground(nscolor aColor) { mCanvasBackgroundColor = aColor; }
nscolor GetCanvasBackground() { return mCanvasBackgroundColor; }
/* Use the current frame tree (if it exists) to update the background
* color of the most recent canvas.
*/
virtual void UpdateCanvasBackground() = 0;
protected:
// IMPORTANT: The ownership implicit in the following member variables
// has been explicitly checked. If you add any members to this class,

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

@ -940,6 +940,36 @@ nsLayoutUtils::GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt,
return result;
}
/**
* A simple display item that just renders a solid color across the entire
* visible area.
*/
class nsDisplaySolidColor : public nsDisplayItem {
public:
nsDisplaySolidColor(nsIFrame* aFrame, nscolor aColor)
: nsDisplayItem(aFrame), mColor(aColor) {
MOZ_COUNT_CTOR(nsDisplaySolidColor);
}
#ifdef NS_BUILD_REFCNT_LOGGING
virtual ~nsDisplaySolidColor() {
MOZ_COUNT_DTOR(nsDisplaySolidColor);
}
#endif
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx,
const nsRect& aDirtyRect);
NS_DISPLAY_DECL_NAME("SolidColor")
private:
nscolor mColor;
};
void nsDisplaySolidColor::Paint(nsDisplayListBuilder* aBuilder,
nsIRenderingContext* aCtx, const nsRect& aDirtyRect)
{
aCtx->SetColor(mColor);
aCtx->FillRect(aDirtyRect);
}
/**
* Remove all leaf display items that are not for descendants of
* aBuilder->GetReferenceFrame() from aList, and move all nsDisplayClip
@ -1077,9 +1107,7 @@ nsLayoutUtils::PaintFrame(nsIRenderingContext* aRenderingContext, nsIFrame* aFra
// document (at least!) so this will be removed by the optimizer. In some
// cases we might not have a root frame, so this will prevent garbage
// from being drawn.
rv = list.AppendNewToBottom(new (&builder) nsDisplaySolidColor(
nsRect(builder.ToReferenceFrame(aFrame), aFrame->GetSize()),
aBackground));
rv = list.AppendNewToBottom(new (&builder) nsDisplaySolidColor(aFrame, aBackground));
NS_ENSURE_SUCCESS(rv, rv);
}

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

@ -1130,8 +1130,6 @@ public:
NS_IMETHOD DisableNonTestMouseEvents(PRBool aDisable);
virtual void UpdateCanvasBackground();
protected:
virtual ~PresShell();
@ -5521,19 +5519,6 @@ PresShell::RenderSelection(nsISelection* aSelection,
aScreenRect);
}
void PresShell::UpdateCanvasBackground()
{
// If we have a frame tree and it has style information that
// specifies the background color of the canvas, update our local
// cache of that color.
nsIFrame* rootFrame = FrameConstructor()->GetRootElementStyleFrame();
if (rootFrame) {
const nsStyleBackground* bgStyle =
nsCSSRendering::FindRootFrameBackground(rootFrame);
mCanvasBackgroundColor = bgStyle->mBackgroundColor;
}
}
NS_IMETHODIMP
PresShell::Paint(nsIView* aView,
nsIRenderingContext* aRenderingContext,
@ -5544,7 +5529,15 @@ PresShell::Paint(nsIView* aView,
NS_ASSERTION(!mIsDestroying, "painting a destroyed PresShell");
NS_ASSERTION(aView, "null view");
UpdateCanvasBackground();
// If we have a frame tree and it has style information that
// specifies the background color of the canvas, update our local
// cache of that color.
nsIFrame* rootFrame = FrameConstructor()->GetRootElementStyleFrame();
if (rootFrame) {
const nsStyleBackground* bgStyle =
nsCSSRendering::FindRootFrameBackground(rootFrame);
mCanvasBackgroundColor = bgStyle->mBackgroundColor;
}
// Compute the backstop color for the view.
nscolor bgcolor;

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

@ -321,41 +321,10 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsIView* subdocView = mInnerView->GetFirstChild();
if (!subdocView)
return NS_OK;
// Get the PresShell so we can check if painting is suppressed
// on the subdocument. We use this roundabout way in case we
// don't have a frame tree.
if (!mFrameLoader)
return NS_OK;
nsCOMPtr<nsIDocShell> docShell;
mFrameLoader->GetDocShell(getter_AddRefs(docShell));
if (!docShell)
return NS_OK;
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
if (!presShell)
return NS_OK;
PRBool suppressed = PR_TRUE;
presShell->IsPaintingSuppressed(&suppressed);
nsIFrame* f = static_cast<nsIFrame*>(subdocView->GetClientData());
if (!f || suppressed) {
// If we don't have a frame or painting of the PresShell is suppressed,
// try to draw the default background color. (Bug 485275)
// Get the bounds of subdocView relative to the reference frame.
nsRect shellBounds = subdocView->GetBounds() +
mInnerView->GetPosition() +
GetOffsetTo(aBuilder->ReferenceFrame());
rv = aLists.Content()->AppendNewToBottom(
new (aBuilder) nsDisplaySolidColor(
shellBounds,
presShell->GetCanvasBackground()));
return rv;
}
if (!f)
return NS_OK;
nsRect dirty = aDirtyRect - f->GetOffsetTo(this);
aBuilder->EnterPresShell(f, dirty);