Bug 539356 - Part 9c - Remove old invalidation code. r=bz

This commit is contained in:
Matt Woodrow 2012-08-29 17:39:31 +12:00
parent 2d57efa896
commit cee1aa3599
78 changed files with 168 additions and 1704 deletions

View File

@ -122,14 +122,6 @@ public:
nsRefPtr<nsIDocShell> mDocShell;
};
static void InvalidateFrame(nsIFrame* aFrame, uint32_t aFlags)
{
if (!aFrame)
return;
nsRect rect = nsRect(nsPoint(0, 0), aFrame->GetRect().Size());
aFrame->InvalidateWithFlags(rect, aFlags);
}
NS_IMPL_ISUPPORTS1(nsContentView, nsIContentView)
bool
@ -164,13 +156,6 @@ nsContentView::Update(const ViewConfig& aConfig)
rfp->ContentViewScaleChanged(this);
}
// XXX could be clever here and compute a smaller invalidation
// rect
// NB: we pass INVALIDATE_NO_THEBES_LAYERS here to keep view
// semantics the same for both in-process and out-of-process
// <browser>. This is just a transform of the layer subtree in
// both.
InvalidateFrame(mFrameLoader->GetPrimaryFrameOfOwningContent(), nsIFrame::INVALIDATE_NO_THEBES_LAYERS);
return NS_OK;
}
@ -1833,11 +1818,6 @@ nsFrameLoader::SetRenderMode(uint32_t aRenderMode)
}
mRenderMode = aRenderMode;
// NB: we pass INVALIDATE_NO_THEBES_LAYERS here to keep view
// semantics the same for both in-process and out-of-process
// <browser>. This is just a transform of the layer subtree in
// both.
InvalidateFrame(GetPrimaryFrameOfOwningContent(), nsIFrame::INVALIDATE_NO_THEBES_LAYERS);
return NS_OK;
}
@ -1868,7 +1848,7 @@ nsFrameLoader::SetClipSubdocument(bool aClip)
mClipSubdocument = aClip;
nsIFrame* frame = GetPrimaryFrameOfOwningContent();
if (frame) {
InvalidateFrame(frame, 0);
frame->InvalidateFrame();
frame->PresContext()->PresShell()->
FrameNeedsReflow(frame, nsIPresShell::eResize, NS_FRAME_IS_DIRTY);
nsSubDocumentFrame* subdocFrame = do_QueryFrame(frame);

View File

@ -951,7 +951,7 @@ nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame)
// Set up new frame to draw.
objFrame->FixupWindow(objFrame->GetContentRectRelativeToSelf().Size());
objFrame->Invalidate(objFrame->GetContentRectRelativeToSelf());
objFrame->InvalidateFrame();
}
return NS_OK;
}

View File

@ -35,17 +35,7 @@ nsPaintRequest::GetClientRect(nsIDOMClientRect** aResult)
NS_IMETHODIMP
nsPaintRequest::GetReason(nsAString& aResult)
{
switch (mRequest.mFlags & nsIFrame::INVALIDATE_REASON_MASK) {
case nsIFrame::INVALIDATE_REASON_SCROLL_BLIT:
aResult.AssignLiteral("scroll copy");
break;
case nsIFrame::INVALIDATE_REASON_SCROLL_REPAINT:
aResult.AssignLiteral("scroll repaint");
break;
default:
aResult.Truncate();
break;
}
aResult.AssignLiteral("repaint");
return NS_OK;
}

View File

@ -889,7 +889,7 @@ nsHTMLCanvasElement::InvalidateCanvas()
if (!frame)
return;
frame->Invalidate(frame->GetContentRect() - frame->GetPosition());
frame->InvalidateFrame();
}
int32_t

View File

@ -131,10 +131,10 @@ void VideoFrameContainer::Invalidate()
}
if (frame) {
nsRect contentRect = frame->GetContentRect() - frame->GetPosition();
if (invalidateFrame) {
frame->Invalidate(contentRect);
frame->InvalidateFrame();
} else {
nsRect contentRect = frame->GetContentRect() - frame->GetPosition();
frame->InvalidateLayer(contentRect, nsDisplayItem::TYPE_VIDEO);
}
}

View File

@ -220,12 +220,10 @@ nsDOMWindowUtils::Redraw(uint32_t aCount, uint32_t *aDurationOut)
nsIFrame *rootFrame = presShell->GetRootFrame();
if (rootFrame) {
nsRect r(nsPoint(0, 0), rootFrame->GetSize());
PRIntervalTime iStart = PR_IntervalNow();
for (uint32_t i = 0; i < aCount; i++)
rootFrame->InvalidateWithFlags(r, nsIFrame::INVALIDATE_IMMEDIATE);
rootFrame->InvalidateFrame();
#if defined(MOZ_X11) && defined(MOZ_WIDGET_GTK)
XSync(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), False);
@ -389,14 +387,7 @@ nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
nsIFrame* rootFrame = presShell->FrameManager()->GetRootFrame();
if (rootFrame) {
nsIContent* rootContent =
rootScrollFrame ? rootScrollFrame->GetContent() : nullptr;
nsRect rootDisplayport;
bool usingDisplayport = rootContent &&
nsLayoutUtils::GetDisplayPort(rootContent, &rootDisplayport);
rootFrame->InvalidateWithFlags(
usingDisplayport ? rootDisplayport : rootFrame->GetVisualOverflowRect(),
nsIFrame::INVALIDATE_NO_THEBES_LAYERS);
rootFrame->InvalidateFrame();
// If we are hiding something that is a display root then send empty paint
// transaction in order to release retained layers because it won't get

View File

@ -661,6 +661,14 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(NPRect *invalidRect)
}
#endif
if (container) {
gfxIntSize newSize = container->GetCurrentSize();
if (newSize != oldSize) {
mObjectFrame->InvalidateFrame();
return NS_OK;
}
}
nsPresContext* presContext = mObjectFrame->PresContext();
nsRect rect(presContext->DevPixelsToAppUnits(invalidRect->left),
presContext->DevPixelsToAppUnits(invalidRect->top),
@ -3747,7 +3755,7 @@ void nsPluginInstanceOwner::SetFrame(nsObjectFrame *aFrame)
mObjectFrame->PrepForDrawing(mWidget);
}
mObjectFrame->FixupWindow(mObjectFrame->GetContentRectRelativeToSelf().Size());
mObjectFrame->Invalidate(mObjectFrame->GetContentRectRelativeToSelf());
mObjectFrame->InvalidateFrame();
// Scroll position listening is only required for Carbon event model plugins on Mac OS X.
#if defined(XP_MACOSX) && !defined(NP_NO_CARBON)

View File

@ -7704,11 +7704,6 @@ UpdateViewsForTree(nsIFrame* aFrame,
DoApplyRenderingChangeToTree(child, aFrameManager,
aChange);
} else { // regular frame
if ((child->GetStateBits() & NS_FRAME_HAS_CONTAINER_LAYER) &&
(aChange & nsChangeHint_RepaintFrame)) {
FrameLayerBuilder::InvalidateThebesLayerContents(child,
child->GetVisualOverflowRectRelativeToSelf());
}
UpdateViewsForTree(child, aFrameManager, aChange);
}
}
@ -7750,20 +7745,15 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame,
nsSVGUtils::InvalidateBounds(aFrame);
}
} else {
aFrame->InvalidateOverflowRect();
aFrame->InvalidateFrameSubtree();
}
}
if (aChange & nsChangeHint_UpdateOpacityLayer) {
aFrame->MarkLayersActive(nsChangeHint_UpdateOpacityLayer);
aFrame->InvalidateLayer(aFrame->GetVisualOverflowRectRelativeToSelf(),
nsDisplayItem::TYPE_OPACITY);
}
if (aChange & nsChangeHint_UpdateTransformLayer) {
aFrame->MarkLayersActive(nsChangeHint_UpdateTransformLayer);
// Invalidate the old transformed area. The new transformed area
// will be invalidated by nsFrame::FinishAndStoreOverflowArea.
aFrame->InvalidateTransformLayer();
}
if (aChange & nsChangeHint_ChildrenOnlyTransform) {
// The long comment in ProcessRestyledFrames that precedes the
@ -7775,11 +7765,9 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame,
nsIFrame* childFrame = f->GetFirstPrincipalChild();
for ( ; childFrame; childFrame = childFrame->GetNextSibling()) {
childFrame->MarkLayersActive(nsChangeHint_UpdateTransformLayer);
// Invalidate the old transformed area. The new transformed area
// will be invalidated by nsFrame::FinishAndStoreOverflowArea.
childFrame->InvalidateTransformLayer();
}
}
aFrame->SchedulePaint();
}
}
@ -12433,6 +12421,8 @@ nsCSSFrameConstructor::RecomputePosition(nsIFrame* aFrame)
return true;
}
aFrame->SchedulePaint();
// For relative positioning, we can simply update the frame rect
if (display->mPosition == NS_STYLE_POSITION_RELATIVE) {
nsIFrame* cb = aFrame->GetContainingBlock();
@ -12440,9 +12430,6 @@ nsCSSFrameConstructor::RecomputePosition(nsIFrame* aFrame)
const nsPoint oldOffsets = aFrame->GetRelativeOffset();
nsMargin newOffsets;
// Invalidate the old rect
aFrame->InvalidateOverflowRect();
// Move the frame
nsHTMLReflowState::ComputeRelativeOffsets(
cb->GetStyleVisibility()->mDirection,
@ -12453,9 +12440,6 @@ nsCSSFrameConstructor::RecomputePosition(nsIFrame* aFrame)
aFrame->SetPosition(aFrame->GetPosition() - oldOffsets +
nsPoint(newOffsets.left, newOffsets.top));
// Invalidate the new rect
aFrame->InvalidateFrameSubtree();
return true;
}
@ -12527,9 +12511,6 @@ nsCSSFrameConstructor::RecomputePosition(nsIFrame* aFrame)
reflowState.mComputedMargin.top;
}
// Invalidate the old rect
aFrame->InvalidateFrameSubtree();
// Move the frame
nsPoint pos(parentBorder.left + reflowState.mComputedOffsets.left +
reflowState.mComputedMargin.left,
@ -12537,9 +12518,6 @@ nsCSSFrameConstructor::RecomputePosition(nsIFrame* aFrame)
reflowState.mComputedMargin.top);
aFrame->SetPosition(pos);
// Invalidate the new rect
aFrame->InvalidateFrameSubtree();
return true;
}

View File

@ -483,8 +483,9 @@ void nsCaret::InvalidateOutsideCaret()
nsIFrame *frame = GetCaretFrame();
// Only invalidate if we are not fully contained by our frame's rect.
if (frame && !frame->GetVisualOverflowRect().Contains(GetCaretRect()))
InvalidateRects(mCaretRect, GetHookRect(), frame);
if (frame && !frame->GetVisualOverflowRect().Contains(GetCaretRect())) {
frame->SchedulePaint();
}
}
void nsCaret::UpdateCaretPosition()
@ -613,31 +614,9 @@ nsresult nsCaret::PrimeTimer()
return NS_OK;
}
void nsCaret::InvalidateTextOverflowBlock()
{
// If the nearest block has a potential 'text-overflow' marker then
// invalidate it.
if (mLastContent) {
nsIFrame* caretFrame = mLastContent->GetPrimaryFrame();
if (caretFrame) {
nsIFrame* block = nsLayoutUtils::GetAsBlock(caretFrame) ? caretFrame :
nsLayoutUtils::FindNearestBlockAncestor(caretFrame);
if (block) {
const nsStyleTextReset* style = block->GetStyleTextReset();
if (style->mTextOverflow.mLeft.mType != NS_STYLE_TEXT_OVERFLOW_CLIP ||
style->mTextOverflow.mRight.mType != NS_STYLE_TEXT_OVERFLOW_CLIP) {
block->InvalidateOverflowRect();
}
}
}
}
}
//-----------------------------------------------------------------------------
void nsCaret::StartBlinking()
{
InvalidateTextOverflowBlock();
if (mReadOnly) {
// Make sure the one draw command we use for a readonly caret isn't
// done until the selection is set
@ -661,8 +640,6 @@ void nsCaret::StartBlinking()
//-----------------------------------------------------------------------------
void nsCaret::StopBlinking()
{
InvalidateTextOverflowBlock();
if (mDrawn) // erase the caret if necessary
DrawCaret(true);
@ -721,7 +698,7 @@ nsCaret::DrawAtPositionWithHint(nsIDOMNode* aNode,
}
if (aInvalidate)
InvalidateRects(mCaretRect, mHookRect, theFrame);
theFrame->SchedulePaint();
return true;
}
@ -1137,16 +1114,6 @@ nsCaret::UpdateCaretRects(nsIFrame* aFrame, int32_t aFrameOffset)
return true;
}
// static
void nsCaret::InvalidateRects(const nsRect &aRect, const nsRect &aHook,
nsIFrame *aFrame)
{
NS_ASSERTION(aFrame, "Must have a frame to invalidate");
nsRect rect;
rect.UnionRect(aRect, aHook);
aFrame->Invalidate(rect);
}
//-----------------------------------------------------------------------------
/* static */
void nsCaret::CaretBlinkCallback(nsITimer *aTimer, void *aClosure)

View File

@ -173,10 +173,6 @@ protected:
void StartBlinking();
void StopBlinking();
// If the nearest block has a potential 'text-overflow' marker then
// invalidate it.
void InvalidateTextOverflowBlock();
bool DrawAtPositionWithHint(nsIDOMNode* aNode,
int32_t aOffset,
nsFrameSelection::HINT aFrameHint,
@ -203,8 +199,6 @@ protected:
void DrawCaret(bool aInvalidate);
void DrawCaretAfterBriefDelay();
bool UpdateCaretRects(nsIFrame* aFrame, int32_t aFrameOffset);
static void InvalidateRects(const nsRect &aRect, const nsRect &aHook,
nsIFrame *aFrame);
nsRect GetHookRect()
{
#ifdef IBMBIDI

View File

@ -2906,8 +2906,7 @@ DocumentViewerImpl::SetFullZoom(float aFullZoom)
nsIFrame* rootFrame = shell->GetRootFrame();
if (rootFrame) {
nsRect rect(nsPoint(0, 0), rootFrame->GetSize());
rootFrame->Invalidate(rect);
rootFrame->InvalidateFrame();
}
return NS_OK;
}

View File

@ -467,22 +467,11 @@ nsFrameManager::InsertFrames(nsIFrame* aParentFrame,
nsresult
nsFrameManager::RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame,
bool aInvalidate /* = true */)
nsIFrame* aOldFrame)
{
bool wasDestroyingFrames = mIsDestroyingFrames;
mIsDestroyingFrames = true;
// In case the reflow doesn't invalidate anything since it just leaves
// a gap where the old frame was, we invalidate it here. (This is
// reasonably likely to happen when removing a last child in a way
// that doesn't change the size of the parent.)
// This has to sure to invalidate the entire overflow rect; this
// is important in the presence of absolute positioning
if (aInvalidate) {
aOldFrame->InvalidateFrameSubtree();
}
NS_ASSERTION(!aOldFrame->GetPrevContinuation() ||
// exception for nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames
aOldFrame->GetType() == nsGkAtoms::textFrame,

View File

@ -95,8 +95,7 @@ public:
nsFrameList& aFrameList);
NS_HIDDEN_(nsresult) RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame,
bool aInvalidate = true);
nsIFrame* aOldFrame);
/*
* Notification that a frame is about to be destroyed. This allows any

View File

@ -776,7 +776,7 @@ nsPresContext::InvalidateThebesLayers()
// FrameLayerBuilder caches invalidation-related values that depend on the
// appunits-per-dev-pixel ratio, so ensure that all ThebesLayer drawing
// is completely flushed.
FrameLayerBuilder::InvalidateThebesLayersInSubtreeWithUntrustedFrameGeometry(rootFrame);
rootFrame->InvalidateFrameSubtree();
}
}
@ -1974,12 +1974,9 @@ nsPresContext::FireDOMPaintEvent()
if (notifyContent) {
// If the pref is set, we still don't post events when they're
// entirely cross-doc.
notifyContent = false;
notifyContent = true;
for (uint32_t i = 0; i < mInvalidateRequests.mRequests.Length(); ++i) {
if (!(mInvalidateRequests.mRequests[i].mFlags &
nsIFrame::INVALIDATE_CROSS_DOC)) {
notifyContent = true;
}
notifyContent = true;
}
}
if (!notifyContent) {

View File

@ -3545,8 +3545,7 @@ PresShell::UnsuppressAndInvalidate()
nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
if (rootFrame) {
// let's assume that outline on a root frame is not supported
nsRect rect(nsPoint(0, 0), rootFrame->GetSize());
rootFrame->Invalidate(rect);
rootFrame->InvalidateFrame();
if (mCaretEnabled && mCaret) {
mCaret->CheckCaretDrawingState();
@ -3954,6 +3953,7 @@ PresShell::DocumentStatesChanged(nsIDocument* aDocument,
}
}
}
ScheduleViewManagerFlush();
}
void
@ -6101,13 +6101,11 @@ PresShell::ShowEventTargetDebug()
if (nsFrame::GetShowEventTargetFrameBorder() &&
GetCurrentEventFrame()) {
if (mDrawEventTargetFrame) {
mDrawEventTargetFrame->Invalidate(
nsRect(nsPoint(0, 0), mDrawEventTargetFrame->GetSize()));
mDrawEventTargetFrame->InvalidateFrame();
}
mDrawEventTargetFrame = mCurrentEventFrame;
mDrawEventTargetFrame->Invalidate(
nsRect(nsPoint(0, 0), mDrawEventTargetFrame->GetSize()));
mDrawEventTargetFrame->InvalidateFrame();
}
}
#endif
@ -7285,6 +7283,8 @@ PresShell::ScheduleReflowOffTimer()
bool
PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
{
target->SchedulePaint();
nsAutoCString docURL("N/A");
nsIURI *uri = mDocument->GetDocumentURI();
if (uri)
@ -7316,11 +7316,6 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
nsSize size;
if (target == rootFrame) {
size = mPresContext->GetVisibleArea().Size();
// target->GetRect() has the old size of the frame,
// mPresContext->GetVisibleArea() has the new size.
target->InvalidateRectDifference(mPresContext->GetVisibleArea(),
target->GetRect());
} else {
size = target->GetSize();
}

View File

@ -356,7 +356,7 @@ nsComboboxControlFrame::SetFocus(bool aOn, bool aRepaint)
// This is needed on a temporary basis. It causes the focus
// rect to be drawn. This is much faster than ReResolvingStyle
// Bug 32920
Invalidate(nsRect(0,0,mRect.width,mRect.height));
InvalidateFrame();
}
void

View File

@ -584,7 +584,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, mContentFrame);
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowState, aStatus);
Invalidate(aDesiredSize.VisualOverflow());
InvalidateFrame();
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return NS_OK;

View File

@ -256,15 +256,7 @@ nsListControlFrame::InvalidateFocus()
nsIFrame* containerFrame = GetOptionsContainer();
if (containerFrame) {
// Invalidating from the containerFrame because that's where our focus
// is drawn.
// The origin of the scrollport is the origin of containerFrame.
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
nsRect invalidateArea = containerFrame->GetVisualOverflowRect();
nsRect emptyFallbackArea(0, 0, GetScrollPortRect().width,
CalcFallbackRowHeight(inflation));
invalidateArea.UnionRect(invalidateArea, emptyFallbackArea);
containerFrame->Invalidate(invalidateArea);
containerFrame->InvalidateFrame();
}
}
@ -1681,18 +1673,6 @@ nsListControlFrame::GetType() const
return nsGkAtoms::listControlFrame;
}
void
nsListControlFrame::InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY, nsIFrame* aForChild,
uint32_t aFlags)
{
if (!IsInDropDownMode()) {
nsHTMLScrollFrame::InvalidateInternal(aDamageRect, aX, aY, this, aFlags);
return;
}
InvalidateRoot(aDamageRect + nsPoint(aX, aY), aFlags);
}
#ifdef DEBUG
NS_IMETHODIMP
nsListControlFrame::GetFrameName(nsAString& aResult) const

View File

@ -92,10 +92,6 @@ public:
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
virtual void InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY, nsIFrame* aForChild,
uint32_t aFlags) MOZ_OVERRIDE;
#ifdef DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
#endif

View File

@ -209,7 +209,7 @@ nsMeterFrame::AttributeChanged(int32_t aNameSpaceID,
PresContext()->PresShell()->FrameNeedsReflow(barFrame,
nsIPresShell::eResize,
NS_FRAME_IS_DIRTY);
Invalidate(GetVisualOverflowRectRelativeToSelf());
InvalidateFrame();
}
return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute,

View File

@ -224,7 +224,7 @@ nsProgressFrame::AttributeChanged(int32_t aNameSpaceID,
NS_ASSERTION(barFrame, "The progress frame should have a child with a frame!");
PresContext()->PresShell()->FrameNeedsReflow(barFrame, nsIPresShell::eResize,
NS_FRAME_IS_DIRTY);
Invalidate(GetVisualOverflowRectRelativeToSelf());
InvalidateFrame();
}
return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);

View File

@ -541,9 +541,6 @@ nsTextControlFrame::Reflow(nsPresContext* aPresContext,
kid = kid->GetNextSibling();
}
// If we're resizing, we might need to invalidate our border areas and such
CheckInvalidateSizeChange(aDesiredSize);
// take into account css properties that affect overflow handling
FinishAndStoreOverflow(&aDesiredSize);

View File

@ -456,23 +456,6 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
nsContainerFrame::PositionChildViews(aKidFrame);
}
if (oldRect.TopLeft() != rect.TopLeft() ||
(aDelegatingFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
// The frame moved
aKidFrame->GetParent()->Invalidate(oldOverflowRect);
aKidFrame->InvalidateFrameSubtree();
} else if (oldRect.Size() != rect.Size()) {
// Invalidate the area where the frame changed size.
nscoord innerWidth = NS_MIN(oldRect.width, rect.width);
nscoord innerHeight = NS_MIN(oldRect.height, rect.height);
nscoord outerWidth = NS_MAX(oldRect.width, rect.width);
nscoord outerHeight = NS_MAX(oldRect.height, rect.height);
aKidFrame->GetParent()->Invalidate(
nsRect(rect.x + innerWidth, rect.y, outerWidth - innerWidth, outerHeight));
// Invalidate the horizontal strip
aKidFrame->GetParent()->Invalidate(
nsRect(rect.x, rect.y + innerHeight, outerWidth, outerHeight - innerHeight));
}
aKidFrame->DidReflow(aPresContext, &kidReflowState, NS_FRAME_REFLOW_FINISHED);
#ifdef DEBUG

View File

@ -487,32 +487,6 @@ nsBlockFrame::GetType() const
return nsGkAtoms::blockFrame;
}
void
nsBlockFrame::InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY, nsIFrame* aForChild,
uint32_t aFlags)
{
// Optimize by suppressing invalidation of areas that are clipped out
// with CSS 'clip'. Don't suppress invalidation of *this* frame directly,
// because when 'clip' shrinks we need to invalidate this frame and
// be able to invalidate areas outside the 'clip'.
if (aForChild) {
const nsStyleDisplay* disp = GetStyleDisplay();
nsRect clipRect;
if (GetClipPropClipRect(disp, &clipRect, GetSize())) {
// Restrict the invalidated area to abs-pos clip rect
// abs-pos clipping clips everything in the frame
nsRect r;
if (r.IntersectRect(aDamageRect, clipRect - nsPoint(aX, aY))) {
nsBlockFrameSuper::InvalidateInternal(r, aX, aY, this, aFlags);
}
return;
}
}
nsBlockFrameSuper::InvalidateInternal(aDamageRect, aX, aY, this, aFlags);
}
nscoord
nsBlockFrame::GetBaseline() const
{
@ -1214,9 +1188,6 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
}
}
// Determine if we need to repaint our border, background or outline
CheckInvalidateSizeChange(aMetrics);
FinishAndStoreOverflow(&aMetrics);
// Clear the float manager pointer in the block reflow state so we
@ -2476,18 +2447,6 @@ nsBlockFrame::DeleteLine(nsBlockReflowState& aState,
}
}
static void
InvalidateThebesLayersInLineBox(nsIFrame* aBlock, nsLineBox* aLine)
{
if (aBlock->GetStateBits() & NS_FRAME_HAS_CONTAINER_LAYER_DESCENDANT) {
int32_t childCount = aLine->GetChildCount();
for (nsIFrame* f = aLine->mFirstChild; childCount;
--childCount, f = f->GetNextSibling()) {
FrameLayerBuilder::InvalidateThebesLayersInSubtree(f);
}
}
}
/**
* Reflow a line. The line will either contain a single block frame
* or contain 1 or more inline frames. aKeepReflowGoing indicates
@ -2510,78 +2469,10 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
// Now that we know what kind of line we have, reflow it
if (aLine->IsBlock()) {
nsRect oldBounds = aLine->mFirstChild->GetRect();
nsRect oldVisOverflow(aLine->GetVisualOverflowArea());
rv = ReflowBlockFrame(aState, aLine, aKeepReflowGoing);
nsRect newBounds = aLine->mFirstChild->GetRect();
// We expect blocks to damage any area inside their bounds that is
// dirty; however, if the frame changes size or position then we
// need to do some repainting.
// XXX roc --- the above statement is ambiguous about whether 'bounds'
// means the frame's bounds or overflowArea, and in fact this is a source
// of much confusion and bugs. Thus the following hack considers *both*
// overflowArea and bounds. This should be considered a temporary hack
// until we decide how it's really supposed to work.
// Note that we have a similar hack in nsTableFrame::InvalidateFrame.
nsRect visOverflow(aLine->GetVisualOverflowArea());
if (oldVisOverflow.TopLeft() != visOverflow.TopLeft() ||
oldBounds.TopLeft() != newBounds.TopLeft()) {
// The block has moved, and so to be safe we need to repaint
// XXX We need to improve on this...
nsRect dirtyRect;
dirtyRect.UnionRect(oldVisOverflow, visOverflow);
#ifdef NOISY_BLOCK_INVALIDATE
printf("%p invalidate 6 (%d, %d, %d, %d)\n",
this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height);
#endif
Invalidate(dirtyRect);
FrameLayerBuilder::InvalidateThebesLayersInSubtree(aLine->mFirstChild);
} else {
nsRect combinedAreaHStrip, combinedAreaVStrip;
nsRect boundsHStrip, boundsVStrip;
nsLayoutUtils::GetRectDifferenceStrips(oldBounds, newBounds,
&boundsHStrip, &boundsVStrip);
nsLayoutUtils::GetRectDifferenceStrips(oldVisOverflow, visOverflow,
&combinedAreaHStrip,
&combinedAreaVStrip);
#ifdef NOISY_BLOCK_INVALIDATE
printf("%p invalidate boundsVStrip (%d, %d, %d, %d)\n",
this, boundsVStrip.x, boundsVStrip.y, boundsVStrip.width, boundsVStrip.height);
printf("%p invalidate boundsHStrip (%d, %d, %d, %d)\n",
this, boundsHStrip.x, boundsHStrip.y, boundsHStrip.width, boundsHStrip.height);
printf("%p invalidate combinedAreaVStrip (%d, %d, %d, %d)\n",
this, combinedAreaVStrip.x, combinedAreaVStrip.y, combinedAreaVStrip.width, combinedAreaVStrip.height);
printf("%p invalidate combinedAreaHStrip (%d, %d, %d, %d)\n",
this, combinedAreaHStrip.x, combinedAreaHStrip.y, combinedAreaHStrip.width, combinedAreaHStrip.height);
#endif
// The first thing Invalidate does is check if the rect is empty, so
// don't bother doing that here.
Invalidate(boundsVStrip);
Invalidate(boundsHStrip);
Invalidate(combinedAreaVStrip);
Invalidate(combinedAreaHStrip);
}
}
else {
nsRect oldVisOverflow(aLine->GetVisualOverflowArea());
} else {
aLine->SetLineWrapped(false);
rv = ReflowInlineFrames(aState, aLine, aKeepReflowGoing);
// We don't really know what changed in the line, so use the union
// of the old and new combined areas
nsRect dirtyRect;
dirtyRect.UnionRect(oldVisOverflow, aLine->GetVisualOverflowArea());
#ifdef NOISY_BLOCK_INVALIDATE
printf("%p invalidate (%d, %d, %d, %d)\n",
this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height);
if (aLine->IsForceInvalidate())
printf(" dirty line is %p\n", static_cast<void*>(aLine.get()));
#endif
Invalidate(dirtyRect);
InvalidateThebesLayersInLineBox(this, aLine);
}
return rv;
@ -2685,9 +2576,6 @@ nsBlockFrame::PullFrameFrom(nsBlockReflowState& aState,
} else {
// Free up the fromLine now that it's empty
// Its bounds might need to be redrawn, though.
// XXX WHY do we invalidate the bounds AND the combined area? doesn't
// the combined area always enclose the bounds?
Invalidate(fromLine->mBounds);
FrameLines* overflowLines =
aFromOverflowLine ? aFromContainer->RemoveOverflowLines() : nullptr;
nsLineList* fromLineList =
@ -2695,7 +2583,6 @@ nsBlockFrame::PullFrameFrom(nsBlockReflowState& aState,
if (aFromLine.next() != fromLineList->end())
aFromLine.next()->MarkPreviousMarginDirty();
Invalidate(fromLine->GetVisualOverflowArea());
fromLineList->erase(aFromLine);
// aFromLine is now invalid
aFromContainer->FreeLineBox(fromLine);
@ -2735,11 +2622,8 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState,
{
NS_PRECONDITION(aDY != 0, "why slide a line nowhere?");
Invalidate(aLine->GetVisualOverflowArea());
// Adjust line state
aLine->SlideBy(aDY);
Invalidate(aLine->GetVisualOverflowArea());
InvalidateThebesLayersInLineBox(this, aLine);
// Adjust the frames in the line
nsIFrame* kid = aLine->mFirstChild;
@ -3038,9 +2922,6 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
// its view as needed.
nsPoint originalPosition = frame->GetPosition();
while (true) {
// Save the frame's current position. We might need it later.
nscoord passOriginalY = frame->GetRect().y;
clearance = 0;
nscoord topMargin = 0;
bool mayNeedRetry = false;
@ -3207,14 +3088,6 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
clearance, aState.IsAdjacentWithTop(),
aLine.get(), blockHtmlRS, frameReflowStatus, aState);
// If this was a second-pass reflow and the block's vertical position
// changed, invalidates from the first pass might have happened in the
// wrong places. Invalidate the entire overflow rect at the new position.
if (!mayNeedRetry && clearanceFrame &&
frame->GetRect().y != passOriginalY) {
Invalidate(frame->GetVisualOverflowRect() + frame->GetPosition());
}
NS_ENSURE_SUCCESS(rv, rv);
if (mayNeedRetry && clearanceFrame) {
@ -5540,7 +5413,6 @@ nsBlockFrame::DoRemoveFrame(nsIFrame* aDeletedFrame, uint32_t aFlags)
this, visOverflow.x, visOverflow.y,
visOverflow.width, visOverflow.height);
#endif
Invalidate(visOverflow);
} else {
// XXX update searchingOverflowList directly, remove only when empty
FrameLines* overflowLines = RemoveOverflowLines();
@ -5999,24 +5871,8 @@ nsBlockFrame::ReflowPushedFloats(nsBlockReflowState& aState,
}
if (NS_SUBTREE_DIRTY(f) || aState.mReflowState.ShouldReflowAllKids()) {
// Cache old bounds
nsRect oldRect = f->GetRect();
nsRect oldOverflow = f->GetVisualOverflowRect();
// Reflow
aState.FlowAndPlaceFloat(f);
// Invalidate if there was a position or size change
nsRect rect = f->GetRect();
if (!rect.IsEqualInterior(oldRect)) {
nsRect dirtyRect = oldOverflow;
dirtyRect.MoveBy(oldRect.x, oldRect.y);
Invalidate(dirtyRect);
dirtyRect = f->GetVisualOverflowRect();
dirtyRect.MoveBy(rect.x, rect.y);
Invalidate(dirtyRect);
}
}
else {
// Just reload the float region into the space manager

View File

@ -158,9 +158,6 @@ public:
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists);
virtual void InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY, nsIFrame* aForChild,
uint32_t aFlags);
virtual nsIAtom* GetType() const;
virtual bool IsFrameOfType(uint32_t aFlags) const
{

View File

@ -790,7 +790,6 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
aFloat->SetPosition(origin);
nsContainerFrame::PositionFrameView(aFloat);
nsContainerFrame::PositionChildViews(aFloat);
FrameLayerBuilder::InvalidateThebesLayersInSubtree(aFloat);
}
// Update the float combined area state

View File

@ -1481,7 +1481,7 @@ NS_IMETHODIMP nsBulletFrame::OnDataAvailable(imgIRequest *aRequest,
// The image has changed.
// Invalidate the entire content area. Maybe it's not optimal but it's simple and
// always correct, and I'll be a stunned mullet if it ever matters for performance
Invalidate(nsRect(0, 0, mRect.width, mRect.height));
InvalidateFrame();
return NS_OK;
}
@ -1523,7 +1523,7 @@ NS_IMETHODIMP nsBulletFrame::FrameChanged(imgIRequest *aRequest,
{
// Invalidate the entire content area. Maybe it's not optimal but it's simple and
// always correct.
Invalidate(nsRect(0, 0, mRect.width, mRect.height));
InvalidateFrame();
return NS_OK;
}

View File

@ -156,12 +156,6 @@ nsCanvasFrame::RemoveFrame(ChildListID aListID,
if (aOldFrame != mFrames.FirstChild())
return NS_ERROR_FAILURE;
// It's our one and only child frame
// Damage the area occupied by the deleted frame
// The child of the canvas probably can't have an outline, but why bother
// thinking about that?
Invalidate(aOldFrame->GetVisualOverflowRect() + aOldFrame->GetPosition());
// Remove the frame and destroy it
mFrames.DestroyFrame(aOldFrame);
@ -507,15 +501,7 @@ nsCanvasFrame::Reflow(nsPresContext* aPresContext,
// could also include overflow to our top and left (out of the viewport)
// which doesn't need to be painted.
nsIFrame* viewport = PresContext()->GetPresShell()->GetRootFrame();
viewport->Invalidate(nsRect(nsPoint(0, 0), viewport->GetSize()));
} else {
nsRect newKidRect = kidFrame->GetRect();
if (newKidRect.TopLeft() == oldKidRect.TopLeft()) {
InvalidateRectDifference(oldKidRect, kidFrame->GetRect());
} else {
Invalidate(oldKidRect);
Invalidate(newKidRect);
}
viewport->InvalidateFrame();
}
// Return our desired size. Normally it's what we're told, but
@ -559,7 +545,7 @@ nsCanvasFrame::Reflow(nsPresContext* aPresContext,
const nsStyleBackground::Layer& layer = bg->mLayers[i];
if (layer.mAttachment == NS_STYLE_BG_ATTACHMENT_FIXED &&
layer.RenderingMightDependOnFrameSize()) {
Invalidate(nsRect(nsPoint(0, 0), GetSize()));
InvalidateFrame();
break;
}
}

View File

@ -441,13 +441,7 @@ static void MoveChildTo(nsIFrame* aParent, nsIFrame* aChild, nsPoint aOrigin) {
return;
}
nsRect r = aChild->GetVisualOverflowRect();
r += aChild->GetPosition();
aParent->Invalidate(r);
r -= aChild->GetPosition();
aChild->SetPosition(aOrigin);
r += aOrigin;
aParent->Invalidate(r);
PlaceFrameView(aChild);
}
@ -1085,8 +1079,6 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
aStatus = NS_FRAME_COMPLETE;
}
CheckInvalidateSizeChange(aDesiredSize);
// XXXjwir3: This call should be replaced with FinishWithAbsoluteFrames
// when bug 724978 is fixed and nsColumnSetFrame is a full absolute
// container.

View File

@ -930,11 +930,6 @@ nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
aKidFrame->WillReflow(aPresContext);
if (NS_FRAME_NO_MOVE_FRAME != (aFlags & NS_FRAME_NO_MOVE_FRAME)) {
if ((aFlags & NS_FRAME_INVALIDATE_ON_MOVE) &&
!(aKidFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) &&
aKidFrame->GetPosition() != nsPoint(aX, aY)) {
aKidFrame->InvalidateFrameSubtree();
}
aKidFrame->SetPosition(nsPoint(aX, aY));
}
@ -1043,13 +1038,6 @@ nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
// correctly positioned
PositionChildViews(aKidFrame);
}
// We also need to redraw everything associated with the frame
// because if the frame's Reflow issued any invalidates, then they
// will be at the wrong offset ... note that this includes
// invalidates issued against the frame's children, so we need to
// invalidate the overflow area too.
aKidFrame->Invalidate(aDesiredSize.VisualOverflow());
}
return aKidFrame->DidReflow(aPresContext, aReflowState, NS_FRAME_REFLOW_FINISHED);
@ -1129,10 +1117,6 @@ nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext* aPres
frame, availSpace);
nsReflowStatus frameStatus = NS_FRAME_COMPLETE;
// Cache old bounds
nsRect oldRect = frame->GetRect();
nsRect oldOverflow = frame->GetVisualOverflowRect();
// Reflow
rv = ReflowChild(frame, aPresContext, desiredSize, frameState,
prevRect.x, 0, aFlags, frameStatus, &tracker);
@ -1143,18 +1127,6 @@ nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext* aPres
prevRect.x, 0, aFlags);
NS_ENSURE_SUCCESS(rv, rv);
// Invalidate if there was a position or size change
nsRect rect = frame->GetRect();
if (!rect.IsEqualInterior(oldRect)) {
nsRect dirtyRect = oldOverflow;
dirtyRect.MoveBy(oldRect.x, oldRect.y);
Invalidate(dirtyRect);
dirtyRect = frame->GetVisualOverflowRect();
dirtyRect.MoveBy(rect.x, rect.y);
Invalidate(dirtyRect);
}
// Handle continuations
if (!NS_FRAME_IS_FULLY_COMPLETE(frameStatus)) {
if (frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
@ -1369,8 +1341,6 @@ nsContainerFrame::DeleteNextInFlowChild(nsPresContext* aPresContext,
}
}
aNextInFlow->InvalidateFrameSubtree();
// Take the next-in-flow out of the parent's child list
#ifdef DEBUG
nsresult rv =

View File

@ -4587,46 +4587,6 @@ nsIFrame::IsLeaf() const
return true;
}
Layer*
nsIFrame::InvalidateLayer(const nsRect& aDamageRect, uint32_t aDisplayItemKey)
{
NS_ASSERTION(aDisplayItemKey > 0, "Need a key");
Layer* layer = FrameLayerBuilder::GetDedicatedLayer(this, aDisplayItemKey);
if (!layer) {
Invalidate(aDamageRect);
return nullptr;
}
uint32_t flags = INVALIDATE_NO_THEBES_LAYERS;
if (aDisplayItemKey == nsDisplayItem::TYPE_VIDEO ||
aDisplayItemKey == nsDisplayItem::TYPE_PLUGIN ||
aDisplayItemKey == nsDisplayItem::TYPE_CANVAS) {
flags |= INVALIDATE_NO_UPDATE_LAYER_TREE;
}
InvalidateWithFlags(aDamageRect, flags);
return layer;
}
void
nsIFrame::InvalidateTransformLayer()
{
NS_ASSERTION(mParent, "How can a viewport frame have a transform?");
bool hasLayer =
FrameLayerBuilder::GetDedicatedLayer(this, nsDisplayItem::TYPE_TRANSFORM) != nullptr;
// Invalidate post-transform area in the parent. We have to invalidate
// in the parent because our transform style may have changed from what was
// used to paint this frame.
// It's OK to bypass the SVG effects processing and other processing
// performed if we called this->InvalidateWithFlags, because those effects
// are performed before applying transforms.
mParent->InvalidateInternal(GetVisualOverflowRect() + GetPosition(),
0, 0, this,
hasLayer ? INVALIDATE_NO_THEBES_LAYERS : 0);
}
class LayerActivity {
public:
LayerActivity(nsIFrame* aFrame) : mFrame(aFrame), mChangeHint(nsChangeHint(0)) {}
@ -4723,131 +4683,6 @@ nsFrame::ShutdownLayerActivityTimer()
gLayerActivityTracker = nullptr;
}
void
nsIFrame::InvalidateWithFlags(const nsRect& aDamageRect, uint32_t aFlags)
{
if (aDamageRect.IsEmpty()) {
return;
}
// Don't allow invalidates to do anything when
// painting is suppressed.
nsIPresShell *shell = PresContext()->GetPresShell();
if (shell) {
if (shell->IsPaintingSuppressed())
return;
}
InvalidateInternal(aDamageRect, 0, 0, nullptr, aFlags);
}
/**
* Helper function that funnels an InvalidateInternal request up to the
* parent. This function is used so that if MOZ_SVG is not defined, we still
* have unified control paths in the InvalidateInternal chain.
*
* @param aDamageRect The rect to invalidate.
* @param aX The x offset from the origin of this frame to the rectangle.
* @param aY The y offset from the origin of this frame to the rectangle.
* @param aImmediate Whether to redraw immediately.
* @return None, though this funnels the request up to the parent frame.
*/
void
nsIFrame::InvalidateInternalAfterResize(const nsRect& aDamageRect, nscoord aX,
nscoord aY, uint32_t aFlags)
{
if (aDamageRect.IsEmpty()) {
return;
}
/* If we're a transformed frame, then we need to apply our transform to the
* damage rectangle so that the redraw correctly redraws the transformed
* region. We're moved over aX and aY from our origin, but since this aX
* and aY is contained within our border, we need to scoot back by -aX and
* -aY to get back to the origin of the transform.
*
* There's one more problem, though, and that's that we don't know what
* coordinate space this rectangle is in. Sometimes it's in the local
* coordinate space for the frame, and sometimes its in the transformed
* coordinate space. If we get it wrong, we'll display incorrectly. Until I
* find a better fix for this problem, we'll invalidate the union of the two
* rectangles (original rectangle and transformed rectangle). At least one of
* these will be correct.
*
* When we are preserving-3d, we can have arbitrary hierarchies of preserved 3d
* children. The computed transform on these children is relative to the root
* transform object in the hierarchy, not necessarily their direct ancestor.
* In this case we transform by the child's transform, and mark the rectangle
* as being transformed until it is passed up to the root of the hierarchy.
*
* See bug #452496 for more details.
*/
// Check the transformed flags and remove it
bool rectIsTransformed = (aFlags & INVALIDATE_ALREADY_TRANSFORMED);
if (!Preserves3D()) {
// We only want to remove the flag if we aren't preserving 3d. Otherwise
// the rect will already have been transformed into the root preserve-3d
// frame coordinate space, and we should continue passing it up without
// further transforms.
aFlags &= ~INVALIDATE_ALREADY_TRANSFORMED;
}
if ((mState & NS_FRAME_HAS_CONTAINER_LAYER) &&
!(aFlags & INVALIDATE_NO_THEBES_LAYERS)) {
// XXX need to set INVALIDATE_NO_THEBES_LAYERS for certain kinds of
// invalidation, e.g. video update, 'opacity' change
FrameLayerBuilder::InvalidateThebesLayerContents(this,
aDamageRect + nsPoint(aX, aY));
// Don't need to invalidate any more Thebes layers
aFlags |= INVALIDATE_NO_THEBES_LAYERS;
if (aFlags & INVALIDATE_ONLY_THEBES_LAYERS) {
return;
}
}
if (IsTransformed() && !rectIsTransformed) {
nsRect newDamageRect = nsDisplayTransform::TransformRectOut
(aDamageRect, this, nsPoint(-aX, -aY));
if (!(GetStateBits() & NS_FRAME_SVG_LAYOUT)) {
newDamageRect.UnionRect(newDamageRect, aDamageRect);
}
// If we are preserving 3d, then our computed transform includes that of any
// ancestor frames that also preserve 3d. Mark the rectangle as already being
// transformed into the parent's coordinate space.
if (Preserves3D()) {
aFlags |= INVALIDATE_ALREADY_TRANSFORMED;
}
GetParent()->
InvalidateInternal(newDamageRect, aX + mRect.x, aY + mRect.y, this,
aFlags);
}
else
GetParent()->
InvalidateInternal(aDamageRect, aX + mRect.x, aY + mRect.y, this, aFlags);
}
void
nsIFrame::InvalidateInternal(const nsRect& aDamageRect, nscoord aX, nscoord aY,
nsIFrame* aForChild, uint32_t aFlags)
{
ClearDisplayItemCache();
nsSVGEffects::InvalidateDirectRenderingObservers(this);
if (nsSVGIntegrationUtils::UsingEffectsForFrame(this)) {
nsRect r = nsSVGIntegrationUtils::AdjustInvalidAreaForSVGEffects(this,
aDamageRect + nsPoint(aX, aY));
/* Rectangle is now in our own local space, so aX and aY are effectively
* zero. Thus we'll pretend that the entire time this was in our own
* local coordinate space and do any remaining processing.
*/
InvalidateInternalAfterResize(r, 0, 0, aFlags);
return;
}
InvalidateInternalAfterResize(aDamageRect, aX, aY, aFlags);
}
gfx3DMatrix
nsIFrame::GetTransformMatrix(const nsIFrame* aStopAtAncestor,
nsIFrame** aOutAncestor)
@ -4915,15 +4750,6 @@ nsIFrame::GetTransformMatrix(const nsIFrame* aStopAtAncestor,
0.0f);
}
void
nsIFrame::InvalidateRectDifference(const nsRect& aR1, const nsRect& aR2)
{
nsRect sizeHStrip, sizeVStrip;
nsLayoutUtils::GetRectDifferenceStrips(aR1, aR2, &sizeHStrip, &sizeVStrip);
Invalidate(sizeVStrip);
Invalidate(sizeHStrip);
}
void
nsIFrame::InvalidateFrameSubtree(uint32_t aFlags)
{
@ -4981,12 +4807,6 @@ nsIFrame::IsInvalid()
return HasAnyStateBits(NS_FRAME_NEEDS_PAINT);
}
void
nsIFrame::InvalidateOverflowRect()
{
Invalidate(GetVisualOverflowRectRelativeToSelf());
}
void
nsIFrame::SchedulePaint()
{
@ -5019,40 +4839,6 @@ nsIFrame::InvalidateLayer(const nsRect& aDamageRect, uint32_t aDisplayItemKey)
NS_DECLARE_FRAME_PROPERTY(DeferInvalidatesProperty, nsIFrame::DestroyRegion)
void
nsIFrame::InvalidateRoot(const nsRect& aDamageRect, uint32_t aFlags)
{
NS_ASSERTION(nsLayoutUtils::GetDisplayRootFrame(this) == this,
"Can only call this on display roots");
if ((mState & NS_FRAME_HAS_CONTAINER_LAYER) &&
!(aFlags & INVALIDATE_NO_THEBES_LAYERS)) {
FrameLayerBuilder::InvalidateThebesLayerContents(this, aDamageRect);
if (aFlags & INVALIDATE_ONLY_THEBES_LAYERS) {
return;
}
}
nsRect rect = aDamageRect;
nsRegion* excludeRegion = static_cast<nsRegion*>
(Properties().Get(DeferInvalidatesProperty()));
if (excludeRegion && (aFlags & INVALIDATE_EXCLUDE_CURRENT_PAINT)) {
nsRegion r;
r.Sub(rect, *excludeRegion);
if (r.IsEmpty())
return;
rect = r.GetBounds();
}
if (!(aFlags & INVALIDATE_NO_UPDATE_LAYER_TREE)) {
AddStateBits(NS_FRAME_UPDATE_LAYER_TREE);
}
nsIView* view = GetView();
NS_ASSERTION(view, "This can only be called on frames with views");
view->GetViewManager()->InvalidateViewNoSuppression(view, rect);
}
void
nsIFrame::BeginDeferringInvalidatesForDisplayRoot(const nsRegion& aExcludeRegion)
{
@ -5304,107 +5090,6 @@ nsFrame::UpdateOverflow()
return false;
}
void
nsFrame::CheckInvalidateSizeChange(nsHTMLReflowMetrics& aNewDesiredSize)
{
nsIFrame::CheckInvalidateSizeChange(mRect, GetVisualOverflowRect(),
nsSize(aNewDesiredSize.width, aNewDesiredSize.height));
}
static void
InvalidateRectForFrameSizeChange(nsIFrame* aFrame, const nsRect& aRect)
{
nsStyleContext *bgSC;
if (!nsCSSRendering::FindBackground(aFrame->PresContext(), aFrame, &bgSC)) {
nsIFrame* rootFrame =
aFrame->PresContext()->PresShell()->FrameManager()->GetRootFrame();
rootFrame->Invalidate(nsRect(nsPoint(0, 0), rootFrame->GetSize()));
}
aFrame->Invalidate(aRect);
}
void
nsIFrame::CheckInvalidateSizeChange(const nsRect& aOldRect,
const nsRect& aOldVisualOverflowRect,
const nsSize& aNewDesiredSize)
{
if (aNewDesiredSize == aOldRect.Size())
return;
// Below, we invalidate the old frame area (or, in the case of
// outline, combined area) if the outline, border or background
// settings indicate that something other than the difference
// between the old and new areas needs to be painted. We are
// assuming that the difference between the old and new areas will
// be invalidated by some other means. That also means invalidating
// the old frame area is the same as invalidating the new frame area
// (since in either case the UNION of old and new areas will be
// invalidated)
// We use InvalidateRectForFrameSizeChange throughout this method, even
// though root-invalidation is technically only needed in the case where
// layer.RenderingMightDependOnFrameSize(). This allows us to simplify the
// code somewhat and return immediately after invalidation in the earlier
// cases.
// Invalidate the entire old frame+outline if the frame has an outline
bool anyOutlineOrEffects;
nsRect r = ComputeOutlineAndEffectsRect(this, &anyOutlineOrEffects,
aOldVisualOverflowRect,
aNewDesiredSize,
false);
if (anyOutlineOrEffects) {
r.UnionRect(aOldVisualOverflowRect, r);
InvalidateRectForFrameSizeChange(this, r);
return;
}
// Invalidate the old frame border box if the frame has borders. Those
// borders may be moving.
const nsStyleBorder* border = GetStyleBorder();
NS_FOR_CSS_SIDES(side) {
if (border->GetComputedBorderWidth(side) != 0) {
if ((side == NS_SIDE_LEFT || side == NS_SIDE_TOP) &&
!nsLayoutUtils::HasNonZeroCornerOnSide(border->mBorderRadius, side) &&
!border->GetBorderImage() &&
border->GetBorderStyle(side) == NS_STYLE_BORDER_STYLE_SOLID) {
// We also need to be sure that the bottom-left or top-right
// corner is simple. For example, if the bottom or right border
// has a different color, we would need to invalidate the corner
// area. But that's OK because if there is a right or bottom border,
// we'll invalidate the entire border-box here anyway.
continue;
}
InvalidateRectForFrameSizeChange(this, nsRect(0, 0, aOldRect.width, aOldRect.height));
return;
}
}
const nsStyleBackground *bg = GetStyleBackground();
if (!bg->IsTransparent()) {
// Invalidate the old frame background if the frame has a background
// whose position depends on the size of the frame
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, bg) {
const nsStyleBackground::Layer &layer = bg->mLayers[i];
if (layer.RenderingMightDependOnFrameSize()) {
InvalidateRectForFrameSizeChange(this, nsRect(0, 0, aOldRect.width, aOldRect.height));
return;
}
}
// Invalidate the old frame background if the frame has a background
// that is being clipped by border-radius, since the old or new area
// clipped off by the radius is not necessarily in the area that has
// already been invalidated (even if only the top-left corner has a
// border radius).
if (nsLayoutUtils::HasNonZeroCorner(border->mBorderRadius)) {
InvalidateRectForFrameSizeChange(this, nsRect(0, 0, aOldRect.width, aOldRect.height));
return;
}
}
}
// Define the MAX_FRAME_DEPTH to be the ContentSink's MAX_REFLOW_DEPTH plus
// 4 for the frames above the document's frames:
// the Viewport, GFXScroll, ScrollPort, and Canvas
@ -7140,7 +6825,7 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
// If there is no outline or other effects now, then we don't have
// to do anything here since removing those styles can't require
// repainting of areas that weren't in the old overflow area.
Invalidate(aOverflowAreas.VisualOverflow());
InvalidateFrame();
} else if (hasClipPropClip || didHaveClipPropClip) {
// If we are (or were) clipped by the 'clip' property, and our
// overflow area changes, it might be because the clipping changed.
@ -7148,31 +6833,9 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
// repaint the old overflow area, so if the overflow area has
// changed (in particular, if it grows), we have to repaint the
// new area here.
Invalidate(aOverflowAreas.VisualOverflow());
InvalidateFrame();
}
}
// XXXSDL For SVG the invalidation happens in ReflowSVG for now, so we
// don't currently invalidate SVG here:
if (anyOverflowChanged && hasTransform &&
!(GetStateBits() & NS_FRAME_SVG_LAYOUT)) {
// When there's a transform, changes to that style might require
// repainting of the old and new overflow areas in the widget.
// Repainting of the frame itself will not be required if there's
// a retained layer, so we can call InvalidateLayer here
// which will avoid repainting ThebesLayers if possible.
// nsCSSFrameConstructor::DoApplyRenderingChangeToTree repaints
// the old overflow area in the widget in response to
// nsChangeHint_UpdateTransformLayer. But since the new overflow
// area is not known at that time, we have to handle it here.
// If the overflow area hasn't changed, then it doesn't matter that
// we didn't reach here since repainting the old overflow area was enough.
// If there is no transform now, then the container layer for
// the transform will go away and the frame contents will change
// ThebesLayers, forcing it to be invalidated, so it doesn't matter
// that we didn't reach here.
InvalidateLayer(aOverflowAreas.VisualOverflow(),
nsDisplayItem::TYPE_TRANSFORM);
}
return anyOverflowChanged;
}
@ -7695,11 +7358,8 @@ nsFrame::RefreshSizeCache(nsBoxLayoutState& aState)
if (!DoesNeedRecalc(metrics->mBlockPrefSize))
return NS_OK;
// get the old rect.
nsRect oldRect = GetRect();
// the rect we plan to size to.
nsRect rect(oldRect);
nsRect rect = GetRect();
nsMargin bp(0,0,0,0);
GetBorderAndPadding(bp);
@ -7721,15 +7381,6 @@ nsFrame::RefreshSizeCache(nsBoxLayoutState& aState)
rect.x, rect.y,
metrics->mBlockPrefSize.width, NS_UNCONSTRAINEDSIZE);
nsRect newRect = GetRect();
// make sure we draw any size change
if (oldRect.width != newRect.width || oldRect.height != newRect.height) {
newRect.x = 0;
newRect.y = 0;
Redraw(aState, &newRect);
}
metrics->mBlockMinSize.height = 0;
// ok we need the max ascent of the items on the line. So to do this
// ask the block for its line iterator. Get the max ascent.

View File

@ -391,16 +391,6 @@ public:
//--------------------------------------------------
// Additional methods
/**
* Helper method to invalidate portions of a standard container frame if the
* desired size indicates that the size has changed (specifically border,
* background and outline).
* We assume that the difference between the old frame area and the new
* frame area is invalidated by some other means.
* @param aDesiredSize the new size of the frame
*/
void CheckInvalidateSizeChange(nsHTMLReflowMetrics& aNewDesiredSize);
// Helper function that tests if the frame tree is too deep; if it is
// it marks the frame as "unflowable", zeroes out the metrics, sets
// the reflow status, and returns true. Otherwise, the frame is

View File

@ -160,94 +160,6 @@ nsHTMLScrollFrame::GetType() const
return nsGkAtoms::scrollFrame;
}
void
nsHTMLScrollFrame::InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY, nsIFrame* aForChild,
uint32_t aFlags)
{
if (aForChild) {
if (aForChild == mInner.mScrolledFrame) {
nsRect damage = aDamageRect + nsPoint(aX, aY);
// This is the damage rect that we're going to pass up to our parent.
nsRect parentDamage;
if (mInner.IsIgnoringViewportClipping()) {
parentDamage = damage;
} else {
// If we're using a displayport, we might be displaying an area
// different than our scroll port and the damage needs to be
// clipped to that instead.
nsRect displayport;
bool usingDisplayport = nsLayoutUtils::GetDisplayPort(GetContent(),
&displayport);
if (usingDisplayport) {
parentDamage.IntersectRect(damage, displayport);
} else {
parentDamage.IntersectRect(damage, mInner.mScrollPort);
}
}
if (IsScrollingActive()) {
// This is the damage rect that we're going to pass up and
// only request invalidation of ThebesLayers for.
// damage is now in our coordinate system, which means it was
// translated using the current scroll position. Adjust it to
// reflect the scroll position at last paint, since that's what
// the ThebesLayers are currently set up for.
// This should not be clipped to the scrollport since ThebesLayers
// can contain content outside the scrollport that may need to be
// invalidated.
nsRect thebesLayerDamage = damage + GetScrollPosition() - mInner.mScrollPosAtLastPaint;
if (parentDamage.IsEqualInterior(thebesLayerDamage)) {
// This single call will take care of both rects
nsContainerFrame::InvalidateInternal(parentDamage, 0, 0, aForChild, aFlags);
} else {
// Invalidate rects separately
if (!(aFlags & INVALIDATE_NO_THEBES_LAYERS)) {
nsContainerFrame::InvalidateInternal(thebesLayerDamage, 0, 0, aForChild,
aFlags | INVALIDATE_ONLY_THEBES_LAYERS);
}
if (!(aFlags & INVALIDATE_ONLY_THEBES_LAYERS) && !parentDamage.IsEmpty()) {
nsContainerFrame::InvalidateInternal(parentDamage, 0, 0, aForChild,
aFlags | INVALIDATE_NO_THEBES_LAYERS);
}
}
} else {
if (!parentDamage.IsEmpty()) {
nsContainerFrame::InvalidateInternal(parentDamage, 0, 0, aForChild, aFlags);
}
}
if (mInner.mIsRoot && !parentDamage.IsEqualInterior(damage)) {
// Make sure we notify our prescontext about invalidations outside
// viewport clipping.
// This is important for things that are snapshotting the viewport,
// possibly outside the scrolled bounds.
// We don't need to propagate this any further up, though. Anyone who
// cares about scrolled-out-of-view invalidates had better be listening
// to our window directly.
PresContext()->NotifyInvalidation(damage, aFlags);
}
return;
} else if (aForChild == mInner.mHScrollbarBox) {
if (!mInner.mHasHorizontalScrollbar) {
// Our scrollbars may send up invalidations even when they're collapsed,
// because we just size a collapsed scrollbar to empty and some
// descendants may be non-empty. Suppress that invalidation here.
return;
}
} else if (aForChild == mInner.mVScrollbarBox) {
if (!mInner.mHasVerticalScrollbar) {
// Our scrollbars may send up invalidations even when they're collapsed,
// because we just size a collapsed scrollbar to empty and some
// descendants may be non-empty. Suppress that invalidation here.
return;
}
}
}
nsContainerFrame::InvalidateInternal(aDamageRect, aX, aY, aForChild, aFlags);
}
/**
HTML scrolling implementation
@ -916,8 +828,6 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
state.mContentsOverflowAreas + mInner.mScrolledFrame->GetPosition());
}
CheckInvalidateSizeChange(aDesiredSize);
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowState, aStatus);
if (!InInitialReflow() && !mInner.mHadNonInitialReflow) {
@ -1100,63 +1010,6 @@ nsXULScrollFrame::GetType() const
return nsGkAtoms::scrollFrame;
}
void
nsXULScrollFrame::InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY, nsIFrame* aForChild,
uint32_t aFlags)
{
if (aForChild == mInner.mScrolledFrame) {
nsRect damage = aDamageRect + nsPoint(aX, aY);
// This is the damage rect that we're going to pass up to our parent.
nsRect parentDamage;
// If we're using a displayport, we might be displaying an area
// different than our scroll port and the damage needs to be
// clipped to that instead.
nsRect displayport;
bool usingDisplayport = nsLayoutUtils::GetDisplayPort(GetContent(),
&displayport);
if (usingDisplayport) {
parentDamage.IntersectRect(damage, displayport);
} else {
parentDamage.IntersectRect(damage, mInner.mScrollPort);
}
if (IsScrollingActive()) {
// This is the damage rect that we're going to pass up and
// only request invalidation of ThebesLayers for.
// damage is now in our coordinate system, which means it was
// translated using the current scroll position. Adjust it to
// reflect the scroll position at last paint, since that's what
// the ThebesLayers are currently set up for.
// This should not be clipped to the scrollport since ThebesLayers
// can contain content outside the scrollport that may need to be
// invalidated.
nsRect thebesLayerDamage = damage + GetScrollPosition() - mInner.mScrollPosAtLastPaint;
if (parentDamage.IsEqualInterior(thebesLayerDamage)) {
// This single call will take care of both rects
nsBoxFrame::InvalidateInternal(parentDamage, 0, 0, aForChild, aFlags);
} else {
// Invalidate rects separately
if (!(aFlags & INVALIDATE_NO_THEBES_LAYERS)) {
nsBoxFrame::InvalidateInternal(thebesLayerDamage, 0, 0, aForChild,
aFlags | INVALIDATE_ONLY_THEBES_LAYERS);
}
if (!(aFlags & INVALIDATE_ONLY_THEBES_LAYERS) && !parentDamage.IsEmpty()) {
nsBoxFrame::InvalidateInternal(parentDamage, 0, 0, aForChild,
aFlags | INVALIDATE_NO_THEBES_LAYERS);
}
}
} else {
if (!parentDamage.IsEmpty()) {
nsBoxFrame::InvalidateInternal(parentDamage, 0, 0, aForChild, aFlags);
}
}
return;
}
nsBoxFrame::InvalidateInternal(aDamageRect, aX, aY, aForChild, aFlags);
}
nscoord
nsXULScrollFrame::GetBoxAscent(nsBoxLayoutState& aState)
{
@ -1842,7 +1695,7 @@ InvalidateFixedBackgroundFramesFromList(nsDisplayListBuilder* aBuilder,
item->IsVaryingRelativeToMovingFrame(aBuilder, aMovingFrame)) {
if (FrameLayerBuilder::NeedToInvalidateFixedDisplayItem(aBuilder, item)) {
// FrameLayerBuilder does not take care of scrolling this one
f->Invalidate(item->GetVisibleRect() - item->ToReferenceFrame());
f->InvalidateFrame();
}
}
}
@ -1940,34 +1793,23 @@ void nsGfxScrollFrameInner::ScrollVisual(nsPoint aOldScrolledFramePos)
AdjustViews(mScrolledFrame);
// We need to call this after fixing up the view positions
// to be consistent with the frame hierarchy.
uint32_t flags = nsIFrame::INVALIDATE_REASON_SCROLL_REPAINT;
bool invalidate = false;
bool canScrollWithBlitting = CanScrollWithBlitting(mOuter);
mOuter->RemoveStateBits(NS_SCROLLFRAME_INVALIDATE_CONTENTS_ON_SCROLL);
if (IsScrollingActive()) {
if (!canScrollWithBlitting) {
MarkInactive();
} else {
flags |= nsIFrame::INVALIDATE_NO_THEBES_LAYERS;
invalidate = true;
}
}
if (canScrollWithBlitting) {
MarkActive();
}
nsRect invalidateRect, displayPort;
bool hasDisplayPort =
nsLayoutUtils::GetDisplayPort(mOuter->GetContent(), &displayPort);
if (IsIgnoringViewportClipping()) {
nsRect visualOverflow = mScrolledFrame->GetVisualOverflowRect();
invalidateRect.UnionRect(visualOverflow + mScrolledFrame->GetPosition(),
visualOverflow + aOldScrolledFramePos);
} else {
invalidateRect = hasDisplayPort ? displayPort : mScrollPort;
}
mOuter->SchedulePaint();
mOuter->InvalidateWithFlags(invalidateRect, flags);
if (flags & nsIFrame::INVALIDATE_NO_THEBES_LAYERS) {
if (invalidate) {
nsIFrame* displayRoot = nsLayoutUtils::GetDisplayRootFrame(mOuter);
nsRect update =
GetScrollPortRect() + mOuter->GetOffsetToCrossDoc(displayRoot);
@ -1975,25 +1817,6 @@ void nsGfxScrollFrameInner::ScrollVisual(nsPoint aOldScrolledFramePos)
mOuter->PresContext()->AppUnitsPerDevPixel(),
displayRoot->PresContext()->AppUnitsPerDevPixel());
InvalidateFixedBackgroundFrames(displayRoot, mScrolledFrame, displayRootUpdate);
// Invalidate content that has scrolled into view. Normally, this will
// already be invalid, because it shouldn't have been drawn in any layer,
// but there can be stray rows/columns of pixels that partially overlapped
// the layer's visible region and hence were drawn and added to the layer's
// visible region, but these pixels ended up outside the cliprect after
// snapping so their contents need to be updated now that new content has
// scrolled into the cliprect.
nsPoint scrollDelta = mScrolledFrame->GetPosition() - aOldScrolledFramePos;
if (!hasDisplayPort) {
displayPort = GetScrollPortRect();
}
nsRect preservedContents = displayPort + scrollDelta;
nsRegion invalidate;
invalidate.Sub(displayPort, preservedContents);
nsRegionRectIterator iter(invalidate);
while (const nsRect* r = iter.Next()) {
mOuter->InvalidateWithFlags(*r, nsIFrame::INVALIDATE_REASON_SCROLL_REPAINT);
}
}
}
@ -3260,28 +3083,6 @@ nsXULScrollFrame::LayoutScrollArea(nsBoxLayoutState& aState,
ClampAndSetBounds(aState, childRect, aScrollPosition, true);
}
nsRect finalRect = mInner.mScrolledFrame->GetRect();
nsRect finalVisOverflow = mInner.mScrolledFrame->GetVisualOverflowRect();
// The position of the scrolled frame shouldn't change, but if it does or
// the position of the overflow rect changes just invalidate both the old
// and new overflow rect.
if (originalRect.TopLeft() != finalRect.TopLeft() ||
originalVisOverflow.TopLeft() != finalVisOverflow.TopLeft())
{
// The old overflow rect needs to be adjusted if the frame's position
// changed.
mInner.mScrolledFrame->Invalidate(
originalVisOverflow + originalRect.TopLeft() - finalRect.TopLeft());
mInner.mScrolledFrame->Invalidate(finalVisOverflow);
} else if (!originalVisOverflow.IsEqualInterior(finalVisOverflow)) {
// If the overflow rect changed then invalidate the difference between the
// old and new overflow rects.
mInner.mScrolledFrame->CheckInvalidateSizeChange(
originalRect, originalVisOverflow, finalRect.Size());
mInner.mScrolledFrame->InvalidateRectDifference(
originalVisOverflow, finalVisOverflow);
}
aState.SetLayoutFlags(oldflags);
}
@ -3695,40 +3496,6 @@ nsGfxScrollFrameInner::ReflowCallbackCanceled()
mPostedReflowCallback = false;
}
static void LayoutAndInvalidate(nsBoxLayoutState& aState,
nsIFrame* aBox, const nsRect& aRect,
bool aScrollbarIsBeingHidden)
{
// When a child box changes shape of position, the parent
// is responsible for invalidation; the overflow rect must be invalidated
// to make sure to catch any overflow.
// We invalidate the parent (i.e. the scrollframe) directly, because
// invalidates coming from scrollbars are suppressed by nsHTMLScrollFrame when
// mHasVScrollbar/mHasHScrollbar is false, and this is called after those
// flags have been set ... if a scrollbar is being hidden, we still need
// to invalidate the scrollbar area here.
// But we also need to invalidate the scrollbar itself in case it has
// its own layer; we need to ensure that layer is updated.
bool rectChanged = !aBox->GetRect().IsEqualInterior(aRect);
if (rectChanged) {
if (aScrollbarIsBeingHidden) {
aBox->GetParent()->Invalidate(aBox->GetVisualOverflowRect() +
aBox->GetPosition());
} else {
aBox->InvalidateFrameSubtree();
}
}
nsBoxFrame::LayoutChildAt(aState, aBox, aRect);
if (rectChanged) {
if (aScrollbarIsBeingHidden) {
aBox->GetParent()->Invalidate(aBox->GetVisualOverflowRect() +
aBox->GetPosition());
} else {
aBox->InvalidateFrameSubtree();
}
}
}
bool
nsGfxScrollFrameInner::UpdateOverflow()
{
@ -3823,7 +3590,7 @@ nsGfxScrollFrameInner::LayoutScrollbars(nsBoxLayoutState& aState,
}
if (mScrollCornerBox) {
LayoutAndInvalidate(aState, mScrollCornerBox, r, false);
nsBoxFrame::LayoutChildAt(aState, mScrollCornerBox, r);
}
if (hasResizer) {
@ -3846,11 +3613,11 @@ nsGfxScrollFrameInner::LayoutScrollbars(nsBoxLayoutState& aState,
r.y = aContentArea.YMost() - r.height;
}
LayoutAndInvalidate(aState, mResizerBox, r, false);
nsBoxFrame::LayoutChildAt(aState, mResizerBox, r);
}
else if (mResizerBox) {
// otherwise lay out the resizer with an empty rectangle
LayoutAndInvalidate(aState, mResizerBox, nsRect(), false);
nsBoxFrame::LayoutChildAt(aState, mResizerBox, nsRect());
}
}
@ -3866,7 +3633,7 @@ nsGfxScrollFrameInner::LayoutScrollbars(nsBoxLayoutState& aState,
vRect.Deflate(margin);
}
AdjustScrollbarRectForResizer(mOuter, presContext, vRect, hasResizer, true);
LayoutAndInvalidate(aState, mVScrollbarBox, vRect, !mHasVerticalScrollbar);
nsBoxFrame::LayoutChildAt(aState, mVScrollbarBox, vRect);
}
if (mHScrollbarBox) {
@ -3880,7 +3647,7 @@ nsGfxScrollFrameInner::LayoutScrollbars(nsBoxLayoutState& aState,
hRect.Deflate(margin);
}
AdjustScrollbarRectForResizer(mOuter, presContext, hRect, hasResizer, false);
LayoutAndInvalidate(aState, mHScrollbarBox, hRect, !mHasHorizontalScrollbar);
nsBoxFrame::LayoutChildAt(aState, mHScrollbarBox, hRect);
}
// may need to update fixed position children of the viewport,

View File

@ -423,10 +423,6 @@ public:
return mInner.GetScrolledFrame()->GetContentInsertionFrame();
}
virtual void InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY, nsIFrame* aForChild,
uint32_t aFlags);
virtual bool DoesClipChildren() { return true; }
virtual nsSplittableType GetSplittableType() const;
@ -638,10 +634,6 @@ public:
return mInner.GetScrolledFrame()->GetContentInsertionFrame();
}
virtual void InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY, nsIFrame* aForChild,
uint32_t aFlags);
virtual bool DoesClipChildren() { return true; }
virtual nsSplittableType GetSplittableType() const;

View File

@ -213,10 +213,6 @@ nsHTMLCanvasFrame::Reflow(nsPresContext* aPresContext,
aMetrics.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aMetrics);
if (mRect.width != aMetrics.width || mRect.height != aMetrics.height) {
Invalidate(nsRect(0, 0, mRect.width, mRect.height));
}
// Reflow the single anon block child.
nsReflowStatus childStatus;
nsSize availSize(aReflowState.ComputedWidth(), NS_UNCONSTRAINEDSIZE);

View File

@ -2173,136 +2173,6 @@ public:
*/
bool AreLayersMarkedActive(nsChangeHint aChangeHint);
/**
* @param aFlags see InvalidateInternal below
*/
void InvalidateWithFlags(const nsRect& aDamageRect, uint32_t aFlags);
/**
* Invalidate part of the frame by asking the view manager to repaint.
* aDamageRect is allowed to extend outside the frame's bounds. We'll do the right
* thing.
* We deliberately don't have an Invalidate() method that defaults to the frame's bounds.
* We want all callers to *think* about what has changed in the frame and what area might
* need to be repainted.
*
* @param aDamageRect is in the frame's local coordinate space
*/
void Invalidate(const nsRect& aDamageRect)
{ return InvalidateWithFlags(aDamageRect, 0); }
/**
* As Invalidate above, except that this should be called when the
* rendering that has changed is performed using layers so we can avoid
* updating the contents of ThebesLayers.
* If the frame has a dedicated layer rendering this display item, we
* return that layer.
* @param aDisplayItemKey must not be zero; indicates the kind of display
* item that is being invalidated.
*/
Layer* InvalidateLayer(const nsRect& aDamageRect, uint32_t aDisplayItemKey);
/**
* Invalidate the area of the parent that's covered by the transformed
* visual overflow rect of this frame. Don't depend on the transform style
* for this frame, in case that's changed since this frame was painted.
*/
void InvalidateTransformLayer();
/**
* Helper function that can be overridden by frame classes. The rectangle
* (plus aOffsetX/aOffsetY) is relative to this frame.
*
* The offset is given as two coords rather than as an nsPoint because
* gcc optimizes it better that way, in particular in the default
* implementation that passes the area to the parent frame becomes a tail
* call.
*
* The default implementation will crash if the frame has no parent so
* frames without parents MUST* override.
*
* @param aForChild if the invalidation is coming from a child frame, this
* is the frame; otherwise, this is null.
* @param aFlags INVALIDATE_IMMEDIATE: repaint now if true, repaint later if false.
* In case it's true, pending notifications will be flushed which
* could cause frames to be deleted (including |this|).
* @param aFlags INVALIDATE_CROSS_DOC: true if the invalidation
* originated in a subdocument
* @param aFlags INVALIDATE_REASON_SCROLL_BLIT: set if the invalidation
* was really just the scroll machinery copying pixels from one
* part of the window to another
* @param aFlags INVALIDATE_REASON_SCROLL_REPAINT: set if the invalidation
* was triggered by scrolling
* @param aFlags INVALIDATE_NO_THEBES_LAYERS: don't invalidate the
* ThebesLayers of any container layer owned by an ancestor. Set this
* only if ThebesLayers definitely don't need to be updated.
* @param aFlags INVALIDATE_ONLY_THEBES_LAYERS: invalidate only in the
* ThebesLayers of the nearest container layer.
* @param aFlags INVALIDATE_EXCLUDE_CURRENT_PAINT: if the invalidation
* occurs while we're painting (to be precise, while
* BeginDeferringInvalidatesForDisplayRoot is active on the display root),
* then invalidation in the current paint region is simply discarded.
* Use this flag if areas that are being painted do not need
* to be invalidated. By default, when this flag is not specified,
* areas that are invalidated while currently being painted will be repainted
* again.
* This flag is useful when, during painting, FrameLayerBuilder discovers that
* a region of the window needs to be drawn differently, and that region
* may or may not be contained in the currently painted region.
* @param aFlags INVALIDATE_NO_UPDATE_LAYER_TREE: display lists and the
* layer tree do not need to be updated. This can be used when the layer
* tree has already been updated outside a transaction, e.g. via
* ImageContainer::SetCurrentImage.
*/
enum {
INVALIDATE_IMMEDIATE = 0x01,
INVALIDATE_CROSS_DOC = 0x02,
INVALIDATE_REASON_SCROLL_BLIT = 0x04,
INVALIDATE_REASON_SCROLL_REPAINT = 0x08,
INVALIDATE_REASON_MASK = INVALIDATE_REASON_SCROLL_BLIT |
INVALIDATE_REASON_SCROLL_REPAINT,
INVALIDATE_NO_THEBES_LAYERS = 0x10,
INVALIDATE_ONLY_THEBES_LAYERS = 0x20,
INVALIDATE_EXCLUDE_CURRENT_PAINT = 0x40,
INVALIDATE_NO_UPDATE_LAYER_TREE = 0x80,
INVALIDATE_ALREADY_TRANSFORMED = 0x100
};
virtual void InvalidateInternal(const nsRect& aDamageRect,
nscoord aOffsetX, nscoord aOffsetY,
nsIFrame* aForChild, uint32_t aFlags);
/**
* Helper function that funnels an InvalidateInternal request up to the
* parent. This function is used so that if MOZ_SVG is not defined, we still
* have unified control paths in the InvalidateInternal chain.
*
* @param aDamageRect The rect to invalidate.
* @param aX The x offset from the origin of this frame to the rectangle.
* @param aY The y offset from the origin of this frame to the rectangle.
* @param aImmediate Whether to redraw immediately.
* @return None, though this funnels the request up to the parent frame.
*/
void InvalidateInternalAfterResize(const nsRect& aDamageRect, nscoord aX,
nscoord aY, uint32_t aFlags);
/**
* Take two rectangles in the coordinate system of this frame which
* have the same origin and invalidate the difference between them.
* This is a helper method to be used when a frame is being resized.
*
* @param aR1 the first rectangle
* @param aR2 the second rectangle
*/
void InvalidateRectDifference(const nsRect& aR1, const nsRect& aR2);
/**
* Invalidates this frame's visual overflow rect. Does not necessarily
* cause ThebesLayers for descendant frames to be repainted; only this
* frame can be relied on to be repainted.
*/
void InvalidateOverflowRect();
/**
* Marks all display items created by this frame as needing a repaint,
* and calls SchedulePaint() if requested.
@ -2830,7 +2700,7 @@ NS_PTR_TO_INT32(frame->Properties().Get(nsIFrame::ParagraphDepthProperty()))
bool IsHorizontal() const { return (mState & NS_STATE_IS_HORIZONTAL) != 0; }
bool IsNormalDirection() const { return (mState & NS_STATE_IS_DIRECTION_NORMAL) != 0; }
NS_HIDDEN_(nsresult) Redraw(nsBoxLayoutState& aState, const nsRect* aRect = nullptr);
NS_HIDDEN_(nsresult) Redraw(nsBoxLayoutState& aState);
NS_IMETHOD RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIFrame* aChild)=0;
// XXX take this out after we've branched
virtual bool GetMouseThrough() const { return false; }
@ -2879,17 +2749,6 @@ NS_PTR_TO_INT32(frame->Properties().Get(nsIFrame::ParagraphDepthProperty()))
*/
CaretPosition GetExtremeCaretPosition(bool aStart);
/**
* Same thing as nsFrame::CheckInvalidateSizeChange, but more flexible. The
* implementation of this method must not depend on the mRect or
* GetVisualOverflowRect() of the frame! Note that it's safe to
* assume in this method that the frame origin didn't change. If it
* did, whoever moved the frame will invalidate as needed anyway.
*/
void CheckInvalidateSizeChange(const nsRect& aOldRect,
const nsRect& aOldVisualOverflowRect,
const nsSize& aNewDesiredSize);
/**
* Get a line iterator for this frame, if supported.
*
@ -3052,12 +2911,6 @@ protected:
} mOverflow;
// Helpers
/**
* For frames that have top-level windows (top-level viewports,
* comboboxes, menupoups) this function will invalidate the window.
*/
void InvalidateRoot(const nsRect& aDamageRect, uint32_t aFlags);
/**
* Can we stop inside this frame when we're skipping non-rendered whitespace?
* @param aForward [in] Are we moving forward (or backward) in content order.

View File

@ -588,19 +588,11 @@ nsImageFrame::OnDataAvailable(imgIRequest *aRequest,
if (!aCurrentFrame)
return NS_OK;
// XXX We really need to round this out, now that we're doing better
// image scaling!
nsRect r = aRect->IsEqualInterior(nsIntRect::GetMaxSizedIntRect()) ?
GetInnerArea() :
SourceRectToDest(*aRect);
#ifdef DEBUG_decode
printf("Source rect (%d,%d,%d,%d) -> invalidate dest rect (%d,%d,%d,%d)\n",
aRect->x, aRect->y, aRect->width, aRect->height,
r.x, r.y, r.width, r.height);
printf("Source rect (%d,%d,%d,%d)\n",
aRect->x, aRect->y, aRect->width, aRect->height);
#endif
Invalidate(r);
InvalidateFrame();
return NS_OK;
}
@ -659,10 +651,8 @@ nsImageFrame::NotifyNewCurrentRequest(imgIRequest *aRequest,
NS_FRAME_IS_DIRTY);
}
} else {
nsSize s = GetSize();
nsRect r(0, 0, s.width, s.height);
// Update border+content to account for image change
Invalidate(r);
InvalidateFrame();
}
}
}
@ -681,12 +671,8 @@ nsImageFrame::FrameChanged(imgIRequest *aRequest,
return NS_OK;
}
nsRect r = aDirtyRect->IsEqualInterior(nsIntRect::GetMaxSizedIntRect()) ?
GetInnerArea() :
SourceRectToDest(*aDirtyRect);
// Update border+content to account for image change
Invalidate(r);
InvalidateFrame();
return NS_OK;
}
@ -881,15 +867,6 @@ nsImageFrame::Reflow(nsPresContext* aPresContext,
aMetrics.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aMetrics);
// Now that that's all done, check whether we're resizing... if we are,
// invalidate our rect.
// XXXbz we really only want to do this when reflow is completely done, but
// we have no way to detect when mRect changes (since SetRect is non-virtual,
// so this is the best we can do).
if (mRect.width != aMetrics.width || mRect.height != aMetrics.height) {
Invalidate(nsRect(0, 0, mRect.width, mRect.height));
}
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("exit nsImageFrame::Reflow: size=%d,%d",
aMetrics.width, aMetrics.height));
@ -2011,7 +1988,7 @@ nsImageFrame::IconLoad::OnStopRequest(imgIRequest *aRequest,
nsImageFrame *frame;
while (iter.HasMore()) {
frame = iter.GetNext();
frame->Invalidate(frame->GetRect());
frame->InvalidateFrame();
}
return NS_OK;
@ -2032,7 +2009,7 @@ nsImageFrame::IconLoad::FrameChanged(imgIRequest *aRequest,
nsImageFrame *frame;
while (iter.HasMore()) {
frame = iter.GetNext();
frame->Invalidate(frame->GetRect());
frame->InvalidateFrame();
}
return NS_OK;

View File

@ -981,9 +981,7 @@ nsImageMap::HandleEvent(nsIDOMEvent* aEvent)
area->HasFocus(focus);
//Now invalidate the rect
if (mImageFrame) {
nsRect dmgRect;
area->GetRect(mImageFrame, dmgRect);
mImageFrame->Invalidate(dmgRect);
mImageFrame->InvalidateFrame();
}
break;
}

View File

@ -427,7 +427,7 @@ nsObjectFrame::PrepForDrawing(nsIWidget *aWidget)
// plugins are painted through Thebes and we need to ensure
// the Thebes layer containing the plugin is updated.
if (parentWidget == GetNearestWidget()) {
Invalidate(GetContentRectRelativeToSelf());
InvalidateFrame();
}
#endif

View File

@ -135,7 +135,6 @@ nsPlaceholderFrame::DestroyFrom(nsIFrame* aDestructRoot)
nsIPresShell* shell = PresContext()->GetPresShell();
nsIFrame* oof = mOutOfFlowFrame;
if (oof) {
oof->InvalidateFrameSubtree();
// Unregister out-of-flow frame
shell->FrameManager()->UnregisterPlaceholderFrame(this);
mOutOfFlowFrame = nullptr;
@ -146,7 +145,7 @@ nsPlaceholderFrame::DestroyFrom(nsIFrame* aDestructRoot)
((GetStateBits() & PLACEHOLDER_FOR_POPUP) ||
!nsLayoutUtils::IsProperAncestorFrame(aDestructRoot, oof))) {
ChildListID listId = nsLayoutUtils::GetChildListNameFor(oof);
shell->FrameManager()->RemoveFrame(listId, oof, false);
shell->FrameManager()->RemoveFrame(listId, oof);
}
// else oof will be destroyed by its parent
}

View File

@ -674,19 +674,6 @@ nsSimplePageSequenceFrame::PrePrintNextPage(nsITimerCallback* aCallback, bool* a
return NS_OK;
}
void
nsSimplePageSequenceFrame::InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY,
nsIFrame* aForChild,
uint32_t aFlags)
{
// xxx Invalidate the entire frame as otherwise invalidate of printCanvas
// don't work properly. This is hopefully no longer necessary once 539356
// lands.
nsContainerFrame::InvalidateInternal(
nsRect(nsPoint(0,0), GetSize()), 0, 0, aForChild, aFlags);
}
NS_IMETHODIMP
nsSimplePageSequenceFrame::ResetPrintCanvasList()
{

View File

@ -98,10 +98,6 @@ public:
*/
virtual nsIAtom* GetType() const;
virtual void InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY,
nsIFrame* aForChild,
uint32_t aFlags);
#ifdef DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const;
#endif

View File

@ -656,9 +656,6 @@ nsSubDocumentFrame::Reflow(nsPresContext* aPresContext,
}
}
// Determine if we need to repaint our border, background or outline
CheckInvalidateSizeChange(aDesiredSize);
FinishAndStoreOverflow(&aDesiredSize);
if (!aPresContext->IsPaginated() && !mPostedReflowCallback) {

View File

@ -3383,8 +3383,7 @@ NS_IMETHODIMP nsBlinkTimer::Notify(nsITimer *timer)
// Determine damaged area and tell view manager to redraw it
// blink doesn't blink outline ... I hope
nsRect bounds(nsPoint(0, 0), frameData.mFrame->GetSize());
frameData.mFrame->Invalidate(bounds);
frameData.mFrame->InvalidateFrame();
}
return NS_OK;
}
@ -4431,6 +4430,7 @@ nsTextFrame::CharacterDataChanged(CharacterDataChangeInfo* aInfo)
// will do that when it gets called during reflow.
textFrame->AddStateBits(NS_FRAME_IS_DIRTY);
}
textFrame->InvalidateFrame();
// Below, frames that start after the deleted text will be adjusted so that
// their offsets move with the trailing unchanged text. If this change
@ -6328,7 +6328,7 @@ nsTextFrame::SetSelectedRange(uint32_t aStart, uint32_t aEnd, bool aSelected,
}
}
// Selection might change anything. Invalidate the overflow area.
f->InvalidateOverflowRect();
f->InvalidateFrame();
f = static_cast<nsTextFrame*>(f->GetNextContinuation());
}
@ -8101,7 +8101,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
SetLength(contentLength, &aLineLayout, ALLOW_FRAME_CREATION_AND_DESTRUCTION);
Invalidate(aMetrics.VisualOverflow());
InvalidateFrame();
#ifdef NOISY_REFLOW
ListTag(stdout);

View File

@ -301,10 +301,6 @@ nsVideoFrame::Reflow(nsPresContext* aPresContext,
FinishAndStoreOverflow(&aMetrics);
if (mRect.width != aMetrics.width || mRect.height != aMetrics.height) {
Invalidate(nsRect(0, 0, mRect.width, mRect.height));
}
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("exit nsVideoFrame::Reflow: size=%d,%d",
aMetrics.width, aMetrics.height));

View File

@ -263,8 +263,7 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
// If we were dirty then do a repaint
if (GetStateBits() & NS_FRAME_IS_DIRTY) {
nsRect damageRect(0, 0, aDesiredSize.width, aDesiredSize.height);
Invalidate(damageRect);
InvalidateFrame();
}
// Clipping is handled by the document container (e.g., nsSubDocumentFrame),
@ -292,40 +291,6 @@ ViewportFrame::GetType() const
return nsGkAtoms::viewportFrame;
}
void
ViewportFrame::InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY, nsIFrame* aForChild,
uint32_t aFlags)
{
nsRect r = aDamageRect + nsPoint(aX, aY);
nsPresContext* presContext = PresContext();
presContext->NotifyInvalidation(r, aFlags);
if ((mState & NS_FRAME_HAS_CONTAINER_LAYER) &&
!(aFlags & INVALIDATE_NO_THEBES_LAYERS)) {
FrameLayerBuilder::InvalidateThebesLayerContents(this, r);
// Don't need to invalidate any more Thebes layers
aFlags |= INVALIDATE_NO_THEBES_LAYERS;
if (aFlags & INVALIDATE_ONLY_THEBES_LAYERS) {
return;
}
}
nsIFrame* parent = nsLayoutUtils::GetCrossDocParentFrame(this);
if (parent) {
if (!presContext->PresShell()->IsActive())
return;
nsPoint pt = -parent->GetOffsetToCrossDoc(this);
int32_t ourAPD = presContext->AppUnitsPerDevPixel();
int32_t parentAPD = parent->PresContext()->AppUnitsPerDevPixel();
r = r.ConvertAppUnitsRoundOut(ourAPD, parentAPD);
parent->InvalidateInternal(r, pt.x, pt.y, this,
aFlags | INVALIDATE_CROSS_DOC);
return;
}
InvalidateRoot(r, aFlags);
}
#ifdef DEBUG
NS_IMETHODIMP
ViewportFrame::GetFrameName(nsAString& aResult) const

View File

@ -70,10 +70,6 @@ public:
*/
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
virtual void InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY, nsIFrame* aForChild,
uint32_t aFlags);
#ifdef DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
#endif

View File

@ -103,7 +103,7 @@ inFlasher::RepaintElement(nsIDOMElement* aElement)
nsIFrame* frame = inLayoutUtils::GetFrameFor(aElement);
if (!frame) return NS_OK;
frame->Invalidate(frame->GetRect());
frame->InvalidateFrame();
return NS_OK;
}

View File

@ -838,17 +838,7 @@ RenderFrameParent::TriggerRepaint()
return;
}
// FIXME/cjones: we should collect the rects/regions updated for
// Painted*Layer() calls and pass that region to here, then only
// invalidate that rect
//
// We pass INVALIDATE_NO_THEBES_LAYERS here because we're
// invalidating the <browser> on behalf of its counterpart in the
// content process. Not only do we not need to invalidate the
// shadow layers, things would just break if we did --- we have no
// way to repaint shadow layers from this process.
nsRect rect = nsRect(nsPoint(0, 0), docFrame->GetRect().Size());
docFrame->InvalidateWithFlags(rect, nsIFrame::INVALIDATE_NO_THEBES_LAYERS);
docFrame->SchedulePaint();
}
ShadowLayersParent*

View File

@ -324,25 +324,8 @@ ImageLoader::DoRedraw(FrameSet* aFrameSet)
for (FrameSet::size_type i = 0; i < length; i++) {
nsIFrame* frame = aFrameSet->ElementAt(i);
// NOTE: It is not sufficient to invalidate only the size of the image:
// the image may be tiled!
// The best option is to call into the frame, however lacking this
// we have to at least invalidate the frame's bounds, hence
// as long as we have a frame we'll use its size.
//
// Invalidate the entire frame
// XXX We really only need to invalidate the client area of the frame...
nsRect bounds(nsPoint(0, 0), frame->GetSize());
if (frame->GetType() == nsGkAtoms::canvasFrame) {
// The canvas's background covers the whole viewport.
bounds = frame->GetVisualOverflowRect();
}
if (frame->GetStyleVisibility()->IsVisible()) {
frame->Invalidate(bounds);
frame->InvalidateFrame();
}
}
}

View File

@ -238,7 +238,7 @@ InvalidateAllContinuations(nsIFrame* aFrame)
{
for (nsIFrame* f = aFrame; f;
f = nsLayoutUtils::GetNextContinuationOrSpecialSibling(f)) {
f->InvalidateOverflowRect();
f->InvalidateFrame();
}
}

View File

@ -178,37 +178,6 @@ nsSVGForeignObjectFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
return BuildDisplayListForNonBlockChildren(aBuilder, aDirtyRect, aLists);
}
void
nsSVGForeignObjectFrame::InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY,
nsIFrame* aForChild,
uint32_t aFlags)
{
// This is called by our descendants when they change.
if (GetStateBits() & NS_FRAME_IS_DIRTY) {
// Our entire area has been (or will be) invalidated, so no point
// keeping track of sub-areas that our descendants dirty.
return;
}
if (GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD) {
nsSVGEffects::InvalidateRenderingObservers(this);
return;
}
if (!mInReflow) {
// We can't collect dirty areas, since we don't have a place to reliably
// call FlushDirtyRegion before we paint, so we have to invalidate now.
InvalidateDirtyRect(aDamageRect + nsPoint(aX, aY), aFlags, false);
return;
}
nsRegion* region = (aFlags & INVALIDATE_CROSS_DOC)
? &mSubDocDirtyRegion : &mSameDocDirtyRegion;
region->Or(*region, aDamageRect + nsPoint(aX, aY));
}
bool
nsSVGForeignObjectFrame::IsSVGTransformed(gfxMatrix *aOwnTransform,
gfxMatrix *aFromParentTransform) const
@ -422,12 +391,6 @@ nsSVGForeignObjectFrame::ReflowSVG()
gfxRect(x, y, w, h),
PresContext()->AppUnitsPerCSSPixel());
// Since we'll invalidate our entire area at the end of this method, we
// empty our cached dirty regions to prevent FlushDirtyRegion under DoReflow
// from wasting time invalidating:
mSameDocDirtyRegion.SetEmpty();
mSubDocDirtyRegion.SetEmpty();
// Fully mark our kid dirty so that it gets resized if necessary
// (NS_FRAME_HAS_DIRTY_CHILDREN isn't enough in that case):
nsIFrame* kid = GetFirstPrincipalChild();
@ -648,51 +611,5 @@ nsSVGForeignObjectFrame::DoReflow()
NS_FRAME_NO_MOVE_FRAME);
mInReflow = false;
if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) {
// Since we're a reflow root and can be reflowed independently of our
// outer-<svg>, we can't just blindly pass 'true' here.
FlushDirtyRegion(0, nsSVGUtils::OuterSVGIsCallingReflowSVG(this));
}
}
void
nsSVGForeignObjectFrame::InvalidateDirtyRect(const nsRect& aRect,
uint32_t aFlags,
bool aDuringReflowSVG)
{
if (aRect.IsEmpty())
return;
// Don't invalidate areas outside our bounds:
nsRect rect = aRect.Intersect(nsRect(nsPoint(0,0), mRect.Size()));
if (rect.IsEmpty())
return;
nsSVGUtils::InvalidateBounds(this, aDuringReflowSVG, &rect, aFlags);
}
void
nsSVGForeignObjectFrame::FlushDirtyRegion(uint32_t aFlags,
bool aDuringReflowSVG)
{
NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
"Should not have been called");
NS_ASSERTION(!mInReflow,
"We shouldn't be flushing while we have a pending flush");
if (mSameDocDirtyRegion.IsEmpty() && mSubDocDirtyRegion.IsEmpty()) {
return;
}
InvalidateDirtyRect(mSameDocDirtyRegion.GetBounds(),
aFlags,
aDuringReflowSVG);
InvalidateDirtyRect(mSubDocDirtyRegion.GetBounds(),
aFlags | INVALIDATE_CROSS_DOC,
aDuringReflowSVG);
mSameDocDirtyRegion.SetEmpty();
mSubDocDirtyRegion.SetEmpty();
}

View File

@ -67,10 +67,6 @@ public:
~(nsIFrame::eSVG | nsIFrame::eSVGForeignObject));
}
virtual void InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY, nsIFrame* aForChild,
uint32_t aFlags);
virtual bool IsSVGTransformed(gfxMatrix *aOwnTransform,
gfxMatrix *aFromParentTransform) const;
@ -99,21 +95,11 @@ protected:
void DoReflow();
void RequestReflow(nsIPresShell::IntrinsicDirty aType);
void InvalidateDirtyRect(const nsRect& aRect, uint32_t aFlags,
bool aDuringReflowSVG);
void FlushDirtyRegion(uint32_t aFlags, bool aDuringReflowSVG);
// If width or height is less than or equal to zero we must disable rendering
bool IsDisabled() const { return mRect.width <= 0 || mRect.height <= 0; }
nsAutoPtr<gfxMatrix> mCanvasTM;
// Areas dirtied by changes to decendents that are in our document
nsRegion mSameDocDirtyRegion;
// Areas dirtied by changes to sub-documents embedded by our decendents
nsRegion mSubDocDirtyRegion;
bool mInReflow;
};

View File

@ -561,11 +561,6 @@ void nsTableCellFrame::VerticallyAlignChild(nscoord aMaxAscent)
// if the content is larger than the cell height align from top
kidYTop = NS_MAX(0, kidYTop);
if (kidYTop != kidRect.y) {
// Invalidate at the old position first
firstKid->InvalidateFrameSubtree();
}
firstKid->SetPosition(nsPoint(kidRect.x, kidYTop));
nsHTMLReflowMetrics desiredSize;
desiredSize.width = mRect.width;
@ -580,9 +575,6 @@ void nsTableCellFrame::VerticallyAlignChild(nscoord aMaxAscent)
// Make sure any child views are correctly positioned. We know the inner table
// cell won't have a view
nsContainerFrame::PositionChildViews(firstKid);
// Invalidate new overflow rect
firstKid->InvalidateFrameSubtree();
}
if (HasView()) {
nsContainerFrame::SyncFrameViewAfterReflow(PresContext(), this,
@ -873,9 +865,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext,
}
nsPoint kidOrigin(leftInset, topInset);
nsRect origRect = firstKid->GetRect();
nsRect origVisualOverflow = firstKid->GetVisualOverflowRect();
bool firstReflow = (firstKid->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
ReflowChild(firstKid, aPresContext, kidSize, kidReflowState,
kidOrigin.x, kidOrigin.y, NS_FRAME_INVALIDATE_ON_MOVE, aStatus);
@ -886,11 +875,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext,
printf("Set table cell incomplete %p\n", static_cast<void*>(this));
}
// XXXbz is this invalidate actually needed, really?
if (GetStateBits() & NS_FRAME_IS_DIRTY) {
InvalidateFrameSubtree();
}
#ifdef DEBUG
DebugCheckChildSize(firstKid, kidSize, availSize);
#endif
@ -910,9 +894,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext,
FinishReflowChild(firstKid, aPresContext, &kidReflowState, kidSize,
kidOrigin.x, kidOrigin.y, 0);
nsTableFrame::InvalidateFrame(firstKid, origRect, origVisualOverflow,
firstReflow);
// first, compute the height which can be set w/o being restricted by aMaxSize.height
nscoord cellHeight = kidSize.height;
@ -945,12 +926,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext,
}
}
// If our parent is in initial reflow, it'll handle invalidating our
// entire overflow rect.
if (!(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
CheckInvalidateSizeChange(aDesiredSize);
}
// remember the desired size for this reflow
SetDesiredSize(aDesiredSize);

View File

@ -211,6 +211,13 @@ public:
virtual bool UpdateOverflow();
virtual void InvalidateFrame(uint32_t aFlags = 0)
{
nsIFrame::InvalidateFrame(aFlags);
nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
tableFrame->InvalidateFrame(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
}
protected:
/** implement abstract method on nsContainerFrame */
virtual int GetSkipSides() const;

View File

@ -190,3 +190,11 @@ nsTableColFrame::GetSplittableType() const
return NS_FRAME_NOT_SPLITTABLE;
}
void
nsTableColFrame::InvalidateFrame(uint32_t aFlags)
{
nsIFrame::InvalidateFrame(aFlags);
nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
tableFrame->InvalidateFrame(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
}

View File

@ -264,6 +264,8 @@ public:
return mFinalWidth;
}
virtual void InvalidateFrame(uint32_t aFlags = 0);
protected:
nsTableColFrame(nsStyleContext* aContext);

View File

@ -72,6 +72,8 @@ nsTableColGroupFrame::AddColsToTable(int32_t aFirstColIndex,
{
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
tableFrame->InvalidateFrameSubtree();
// set the col indices of the col frames and and add col info to the table
int32_t colIndex = aFirstColIndex;
nsFrameList::Enumerator e(aCols);
@ -462,6 +464,14 @@ nsTableColGroupFrame::GetType() const
return nsGkAtoms::tableColGroupFrame;
}
void
nsTableColGroupFrame::InvalidateFrame(uint32_t aFlags)
{
nsIFrame::InvalidateFrame(aFlags);
nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
tableFrame->InvalidateFrame(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
}
#ifdef DEBUG
NS_IMETHODIMP
nsTableColGroupFrame::GetFrameName(nsAString& aResult) const

View File

@ -196,6 +196,9 @@ public:
*/
void SetContinuousBCBorderWidth(uint8_t aForSide,
BCPixelSize aPixelValue);
virtual void InvalidateFrame(uint32_t aFlags = 0);
protected:
nsTableColGroupFrame(nsStyleContext* aContext);

View File

@ -1211,10 +1211,7 @@ AnyTablePartHasBorderOrBackground(nsIFrame* aStart, nsIFrame* aEnd)
for (nsIFrame* f = aStart; f != aEnd; f = f->GetNextSibling()) {
NS_ASSERTION(IsFrameAllowedInTable(f->GetType()), "unexpected frame type");
if (f->GetStyleVisibility()->IsVisible() &&
(!f->GetStyleBackground()->IsTransparent() ||
f->GetStyleDisplay()->mAppearance ||
f->GetStyleBorder()->HasBorder()))
if (FrameHasBorderOrBackground(f))
return true;
nsTableCellFrame *cellFrame = do_QueryFrame(f);
@ -1394,10 +1391,7 @@ nsTableFrame::ProcessRowInserted(nscoord aNewHeight)
if (rowFrame->IsFirstInserted()) {
rowFrame->SetFirstInserted(false);
// damage the table from the 1st row inserted to the end of the table
nscoord damageY = rgFrame->GetPosition().y + rowFrame->GetPosition().y;
nsRect damageRect(0, damageY, GetSize().width, aNewHeight - damageY);
Invalidate(damageRect);
InvalidateFrame();
// XXXbz didn't we do this up front? Why do we need to do it again?
SetRowInserted(false);
return; // found it, so leave
@ -1812,13 +1806,6 @@ NS_METHOD nsTableFrame::Reflow(nsPresContext* aPresContext,
}
aDesiredSize.mOverflowAreas.UnionAllWith(tableRect);
if (GetStateBits() & NS_FRAME_FIRST_REFLOW) {
// Fulfill the promise InvalidateFrame makes.
Invalidate(aDesiredSize.VisualOverflow());
} else {
CheckInvalidateSizeChange(aDesiredSize);
}
FinishAndStoreOverflow(&aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return rv;
@ -2504,16 +2491,10 @@ void nsTableFrame::PlaceChild(nsTableReflowState& aReflowState,
const nsRect& aOriginalKidRect,
const nsRect& aOriginalKidVisualOverflow)
{
bool isFirstReflow =
(aKidFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
// Place and size the child
FinishReflowChild(aKidFrame, PresContext(), nullptr, aKidDesiredSize,
aReflowState.x, aReflowState.y, 0);
InvalidateFrame(aKidFrame, aOriginalKidRect, aOriginalKidVisualOverflow,
isFirstReflow);
// Adjust the running y-offset
aReflowState.y += aKidDesiredSize.height;
@ -2948,13 +2929,9 @@ nsTableFrame::ReflowChildren(nsTableReflowState& aReflowState,
aReflowState.y += cellSpacingY;
nsRect kidRect = kidFrame->GetRect();
if (kidRect.y != aReflowState.y) {
// invalidate the old position
kidFrame->InvalidateFrameSubtree();
kidRect.y = aReflowState.y;
kidFrame->SetRect(kidRect); // move to the new position
RePositionViews(kidFrame);
// invalidate the new position
kidFrame->InvalidateFrameSubtree();
}
aReflowState.y += kidRect.height;
@ -3128,17 +3105,13 @@ nsTableFrame::DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
amountUsedByRG += amountForRow;
//rowFrame->DidResize();
nsTableFrame::RePositionViews(rowFrame);
rgFrame->InvalidateRectDifference(oldRowRect, rowRect);
}
}
else {
if (amountUsed > 0 && yOriginRow != rowRect.y &&
!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
rowFrame->InvalidateFrameSubtree();
rowFrame->SetPosition(nsPoint(rowRect.x, yOriginRow));
nsTableFrame::RePositionViews(rowFrame);
rowFrame->InvalidateFrameSubtree();
}
yOriginRow += rowRect.height + cellSpacingY;
yEndRG += rowRect.height + cellSpacingY;
@ -3146,28 +3119,18 @@ nsTableFrame::DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
rowFrame = rowFrame->GetNextRow();
}
if (amountUsed > 0) {
if (rgRect.y != yOriginRG) {
rgFrame->InvalidateFrameSubtree();
}
nsRect origRgRect = rgRect;
nsRect origRgVisualOverflow = rgFrame->GetVisualOverflowRect();
rgRect.y = yOriginRG;
rgRect.height += amountUsedByRG;
rgFrame->SetRect(rgRect);
nsTableFrame::InvalidateFrame(rgFrame, origRgRect,
origRgVisualOverflow, false);
}
}
else if (amountUsed > 0 && yOriginRG != rgRect.y) {
rgFrame->InvalidateFrameSubtree();
rgFrame->SetPosition(nsPoint(rgRect.x, yOriginRG));
// Make sure child views are properly positioned
nsTableFrame::RePositionViews(rgFrame);
rgFrame->InvalidateFrameSubtree();
}
yOriginRG = yEndRG;
}
@ -3275,10 +3238,6 @@ nsTableFrame::DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
? aAmount - amountUsed : NSToCoordRound(((float)(heightToDistribute)) * ratio);
amountForRow = NS_MIN(amountForRow, aAmount - amountUsed);
if (yOriginRow != rowRect.y) {
rowFrame->InvalidateFrameSubtree();
}
// update the row height
nsRect newRowRect(rowRect.x, yOriginRow, rowRect.width,
rowRect.height + amountForRow);
@ -3292,16 +3251,11 @@ nsTableFrame::DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
NS_ASSERTION((amountUsed <= aAmount), "invalid row allocation");
//rowFrame->DidResize();
nsTableFrame::RePositionViews(rowFrame);
nsTableFrame::InvalidateFrame(rowFrame, rowRect, rowVisualOverflow,
false);
}
else {
if (amountUsed > 0 && yOriginRow != rowRect.y) {
rowFrame->InvalidateFrameSubtree();
rowFrame->SetPosition(nsPoint(rowRect.x, yOriginRow));
nsTableFrame::RePositionViews(rowFrame);
rowFrame->InvalidateFrameSubtree();
}
yOriginRow += rowRect.height + cellSpacingY;
yEndRG += rowRect.height + cellSpacingY;
@ -3309,24 +3263,15 @@ nsTableFrame::DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
rowFrame = rowFrame->GetNextRow();
}
if (amountUsed > 0) {
if (rgRect.y != yOriginRG) {
rgFrame->InvalidateFrameSubtree();
}
rgFrame->SetRect(nsRect(rgRect.x, yOriginRG, rgRect.width,
rgRect.height + amountUsedByRG));
nsTableFrame::InvalidateFrame(rgFrame, rgRect, rgVisualOverflow,
false);
}
// Make sure child views are properly positioned
}
else if (amountUsed > 0 && yOriginRG != rgRect.y) {
rgFrame->InvalidateFrameSubtree();
rgFrame->SetPosition(nsPoint(rgRect.x, yOriginRG));
// Make sure child views are properly positioned
nsTableFrame::RePositionViews(rgFrame);
rgFrame->InvalidateFrameSubtree();
}
yOriginRG = yEndRG;
}
@ -7238,43 +7183,3 @@ bool nsTableFrame::RowIsSpannedInto(int32_t aRowIndex, int32_t aNumEffCols)
}
return result;
}
/* static */
void
nsTableFrame::InvalidateFrame(nsIFrame* aFrame,
const nsRect& aOrigRect,
const nsRect& aOrigVisualOverflow,
bool aIsFirstReflow)
{
nsIFrame* parent = aFrame->GetParent();
NS_ASSERTION(parent, "What happened here?");
if (parent->GetStateBits() & NS_FRAME_FIRST_REFLOW) {
// Don't bother; we'll invalidate the parent's overflow rect when
// we finish reflowing it.
return;
}
// The part that looks at both the rect and the overflow rect is a
// bit of a hack. See nsBlockFrame::ReflowLine for an eloquent
// description of its hackishness.
nsRect visualOverflow = aFrame->GetVisualOverflowRect();
if (aIsFirstReflow ||
aOrigRect.TopLeft() != aFrame->GetPosition() ||
aOrigVisualOverflow.TopLeft() != visualOverflow.TopLeft()) {
// Invalidate the old and new overflow rects. Note that if the
// frame moved, we can't just use aOrigVisualOverflow, since it's in
// coordinates relative to the old position. So invalidate via
// aFrame's parent, and reposition that overflow rect to the right
// place.
// XXXbz this doesn't handle outlines, does it?
aFrame->Invalidate(visualOverflow);
parent->Invalidate(aOrigVisualOverflow + aOrigRect.TopLeft());
} else {
nsRect rect = aFrame->GetRect();
aFrame->CheckInvalidateSizeChange(aOrigRect, aOrigVisualOverflow,
rect.Size());
aFrame->InvalidateRectDifference(aOrigVisualOverflow, visualOverflow);
parent->InvalidateRectDifference(aOrigRect, rect);
}
}

View File

@ -33,6 +33,13 @@ static inline bool IS_TABLE_CELL(nsIAtom* frameType) {
nsGkAtoms::bcTableCellFrame == frameType;
}
static inline bool FrameHasBorderOrBackground(nsIFrame* f) {
return (f->GetStyleVisibility()->IsVisible() &&
(!f->GetStyleBackground()->IsTransparent() ||
f->GetStyleDisplay()->mAppearance ||
f->GetStyleBorder()->HasBorder()));
}
class nsDisplayTableItem : public nsDisplayItem
{
public:
@ -457,23 +464,6 @@ public:
bool HasCellSpanningPctCol() const;
void SetHasCellSpanningPctCol(bool aValue);
/**
* To be called on a frame by its parent after setting its size/position and
* calling DidReflow (possibly via FinishReflowChild()). This can also be
* used for child frames which are not being reflowed but did have their size
* or position changed.
*
* @param aFrame The frame to invalidate
* @param aOrigRect The original rect of aFrame (before the change).
* @param aOrigVisualOverflow The original overflow rect of aFrame.
* @param aIsFirstReflow True if the size/position change is due to the
* first reflow of aFrame.
*/
static void InvalidateFrame(nsIFrame* aFrame,
const nsRect& aOrigRect,
const nsRect& aOrigVisualOverflow,
bool aIsFirstReflow);
virtual bool UpdateOverflow();
protected:

View File

@ -916,21 +916,6 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowState *innerRS =
static_cast<nsHTMLReflowState*>((void*) innerRSSpace);
nsRect origInnerRect = InnerTableFrame()->GetRect();
nsRect origInnerVisualOverflow = InnerTableFrame()->GetVisualOverflowRect();
bool innerFirstReflow =
(InnerTableFrame()->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
nsRect origCaptionRect;
nsRect origCaptionVisualOverflow;
bool captionFirstReflow;
if (mCaptionFrames.NotEmpty()) {
origCaptionRect = mCaptionFrames.FirstChild()->GetRect();
origCaptionVisualOverflow =
mCaptionFrames.FirstChild()->GetVisualOverflowRect();
captionFirstReflow =
(mCaptionFrames.FirstChild()->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
}
// ComputeAutoSize has to match this logic.
if (captionSide == NO_SIDE) {
// We don't have a caption.
@ -1052,14 +1037,6 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
innerOrigin.x, innerOrigin.y, 0);
innerRS->~nsHTMLReflowState();
nsTableFrame::InvalidateFrame(InnerTableFrame(), origInnerRect,
origInnerVisualOverflow, innerFirstReflow);
if (mCaptionFrames.NotEmpty()) {
nsTableFrame::InvalidateFrame(mCaptionFrames.FirstChild(), origCaptionRect,
origCaptionVisualOverflow,
captionFirstReflow);
}
UpdateReflowMetrics(captionSide, aDesiredSize, innerMargin, captionMargin);
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aOuterRS, aStatus);

View File

@ -335,13 +335,9 @@ nsTableRowFrame::DidResize()
// resize the cell's height
nsRect cellRect = cellFrame->GetRect();
nsRect cellVisualOverflow = cellFrame->GetVisualOverflowRect();
if (cellRect.height != cellHeight)
{
cellFrame->SetSize(nsSize(cellRect.width, cellHeight));
nsTableFrame::InvalidateFrame(cellFrame, cellRect,
cellVisualOverflow,
false);
}
// realign cell content based on the new height. We might be able to
@ -838,9 +834,6 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
// Reflow the child frame
nsRect kidRect = kidFrame->GetRect();
nsRect kidVisualOverflow = kidFrame->GetVisualOverflowRect();
bool firstReflow =
(kidFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
if (doReflowChild) {
// Calculate the available width for the table cell using the known column widths
@ -930,9 +923,6 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
FinishReflowChild(kidFrame, aPresContext, nullptr, desiredSize, x, 0, 0);
nsTableFrame::InvalidateFrame(kidFrame, kidRect, kidVisualOverflow,
firstReflow);
x += desiredSize.width;
}
else {
@ -1026,12 +1016,6 @@ nsTableRowFrame::Reflow(nsPresContext* aPresContext,
// just set our width to what was available. The table will calculate the width and not use our value.
aDesiredSize.width = aReflowState.availableWidth;
// If our parent is in initial reflow, it'll handle invalidating our
// entire overflow rect.
if (!(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
CheckInvalidateSizeChange(aDesiredSize);
}
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return rv;
}
@ -1078,11 +1062,6 @@ nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
aCellFrame->VerticallyAlignChild(mMaxCellAscent);
}
nsTableFrame::InvalidateFrame(aCellFrame, cellRect,
cellVisualOverflow,
(aCellFrame->GetStateBits() &
NS_FRAME_FIRST_REFLOW) != 0);
aCellFrame->DidReflow(aPresContext, nullptr, NS_FRAME_REFLOW_FINISHED);
return desiredSize.height;
@ -1108,8 +1087,6 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
}
nsRect rowRect = GetRect();
nsRect oldRect = rowRect;
nsRect oldVisualOverflow = GetVisualOverflowRect();
rowRect.y -= aRowOffset;
rowRect.width = aWidth;
@ -1129,7 +1106,7 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
// need to invalidate if our row is not moving, because the cell might
// span out of this row, so invalidating our row rect won't do enough.
if (aRowOffset == 0) {
Invalidate(cRect);
InvalidateFrame();
}
cRect.height = 0;
cellFrame->SetRect(cRect);
@ -1238,12 +1215,6 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
nsSize(cRect.width, cRect.height));
nsTableFrame::RePositionViews(cellFrame);
ConsiderChildOverflow(overflow, cellFrame);
if (aRowOffset == 0) {
nsTableFrame::InvalidateFrame(cellFrame, oldCellRect,
oldCellVisualOverflow,
false);
}
}
kidFrame = iter.Next(); // Get the next child
}
@ -1254,7 +1225,6 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
FinishAndStoreOverflow(overflow, nsSize(rowRect.width, rowRect.height));
nsTableFrame::RePositionViews(this);
nsTableFrame::InvalidateFrame(this, oldRect, oldVisualOverflow, false);
return shift;
}
@ -1381,6 +1351,14 @@ void nsTableRowFrame::InitHasCellWithStyleHeight(nsTableFrame* aTableFrame)
RemoveStateBits(NS_ROW_HAS_CELL_WITH_STYLE_HEIGHT);
}
void
nsTableRowFrame::InvalidateFrame(uint32_t aFlags)
{
nsIFrame::InvalidateFrame(aFlags);
nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
tableFrame->InvalidateFrame(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
}
/* ----- global methods ----- */
nsIFrame*

View File

@ -224,6 +224,8 @@ public:
void SetContinuousBCBorderWidth(uint8_t aForSide,
BCPixelSize aPixelValue);
virtual void InvalidateFrame(uint32_t aFlags = 0);
#ifdef ACCESSIBILITY
virtual already_AddRefed<Accessible> CreateAccessible() MOZ_OVERRIDE;
#endif

View File

@ -254,16 +254,10 @@ nsTableRowGroupFrame::PlaceChild(nsPresContext* aPresContext,
const nsRect& aOriginalKidRect,
const nsRect& aOriginalKidVisualOverflow)
{
bool isFirstReflow =
(aKidFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
// Place and size the child
FinishReflowChild(aKidFrame, aPresContext, nullptr, aDesiredSize, 0,
aReflowState.y, 0);
nsTableFrame::InvalidateFrame(aKidFrame, aOriginalKidRect,
aOriginalKidVisualOverflow, isFirstReflow);
// Adjust the running y-offset
aReflowState.y += aDesiredSize.height;
@ -396,15 +390,7 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
// differently, repaint the entire row
nsRect kidRect(0, aReflowState.y,
desiredSize.width, desiredSize.height);
Invalidate(kidRect);
// Invalidate the area we're offseting. Note that we only
// repaint within our existing frame bounds.
if (kidRect.YMost() < mRect.height) {
nsRect dirtyRect(0, kidRect.YMost(),
mRect.width, mRect.height - kidRect.YMost());
Invalidate(dirtyRect);
}
InvalidateFrame();
}
else if (oldKidRect.height != desiredSize.height)
needToCalcRowHeights = true;
@ -449,11 +435,7 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
else if (needToCalcRowHeights) {
CalculateRowHeights(aPresContext, aDesiredSize, aReflowState.reflowState);
if (!reflowAllKids) {
// Because we don't know what changed repaint everything.
// XXX We should change CalculateRowHeights() to return the bounding
// rect of what changed. Or whether anything moved or changed size...
nsRect dirtyRect(0, 0, mRect.width, mRect.height);
Invalidate(dirtyRect);
InvalidateFrame();
}
}
@ -761,7 +743,6 @@ nsTableRowGroupFrame::CalculateRowHeights(nsPresContext* aPresContext,
// update the rows with their (potentially) new heights
for (rowFrame = startRowFrame, rowIndex = 0; rowFrame; rowFrame = rowFrame->GetNextRow(), rowIndex++) {
nsRect rowBounds = rowFrame->GetRect();
nsRect rowVisualOverflow = rowFrame->GetVisualOverflowRect();
bool movedFrame = (rowBounds.y != yOrigin);
nscoord rowHeight = (rowInfo[rowIndex].height > 0) ? rowInfo[rowIndex].height : 0;
@ -774,9 +755,6 @@ nsTableRowGroupFrame::CalculateRowHeights(nsPresContext* aPresContext,
rowFrame->SetRect(nsRect(rowBounds.x, yOrigin, rowBounds.width,
rowHeight));
nsTableFrame::InvalidateFrame(rowFrame, rowBounds, rowVisualOverflow,
false);
}
if (movedFrame) {
nsTableFrame::RePositionViews(rowFrame);
@ -820,8 +798,6 @@ nsTableRowGroupFrame::CollapseRowGroupIfNecessary(nscoord aYTotalOffset,
}
nsRect groupRect = GetRect();
nsRect oldGroupRect = groupRect;
nsRect oldGroupVisualOverflow = GetVisualOverflowRect();
groupRect.height -= yGroupOffset;
if (didCollapse) {
@ -840,9 +816,6 @@ nsTableRowGroupFrame::CollapseRowGroupIfNecessary(nscoord aYTotalOffset,
overflow.UnionAllWith(nsRect(0, 0, groupRect.width, groupRect.height));
FinishAndStoreOverflow(overflow, nsSize(groupRect.width, groupRect.height));
nsTableFrame::RePositionViews(this);
nsTableFrame::InvalidateFrame(this, oldGroupRect, oldGroupVisualOverflow,
false);
return yGroupOffset;
}
@ -1079,10 +1052,6 @@ nsTableRowGroupFrame::SplitRowGroup(nsPresContext* aPresContext,
rowReflowState.mFlags.mIsTopOfPage = isTopOfPage; // set top of page
nsHTMLReflowMetrics rowMetrics;
// Get the old size before we reflow.
nsRect oldRowRect = rowFrame->GetRect();
nsRect oldRowVisualOverflow = rowFrame->GetVisualOverflowRect();
// Reflow the cell with the constrained height. A cell with rowspan >1 will get this
// reflow later during SplitSpanningCells.
rv = ReflowChild(rowFrame, aPresContext, rowMetrics, rowReflowState,
@ -1092,10 +1061,6 @@ nsTableRowGroupFrame::SplitRowGroup(nsPresContext* aPresContext,
rowFrame->DidReflow(aPresContext, nullptr, NS_FRAME_REFLOW_FINISHED);
rowFrame->DidResize();
nsTableFrame::InvalidateFrame(rowFrame, oldRowRect,
oldRowVisualOverflow,
false);
if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
// The row frame is incomplete and all of the rowspan 1 cells' block frames split
if ((rowMetrics.height <= rowReflowState.availableHeight) || isTopOfPage) {
@ -1323,12 +1288,6 @@ nsTableRowGroupFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.UnionOverflowAreasWithDesiredBounds();
// If our parent is in initial reflow, it'll handle invalidating our
// entire overflow rect.
if (!(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
CheckInvalidateSizeChange(aDesiredSize);
}
FinishAndStoreOverflow(&aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return rv;
@ -1882,3 +1841,11 @@ nsTableRowGroupFrame::FrameCursorData::AppendFrame(nsIFrame* aFrame)
mOverflowBelow = NS_MAX(mOverflowBelow, overflowBelow);
return mFrames.AppendElement(aFrame) != nullptr;
}
void
nsTableRowGroupFrame::InvalidateFrame(uint32_t aFlags)
{
nsIFrame::InvalidateFrame(aFlags);
nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
tableFrame->InvalidateFrame(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
}

View File

@ -325,6 +325,8 @@ public:
virtual nsILineIterator* GetLineIterator() { return this; }
virtual void InvalidateFrame(uint32_t aFlags = 0);
protected:
nsTableRowGroupFrame(nsStyleContext* aContext);

View File

@ -583,22 +583,14 @@ nsBox::SyncLayout(nsBoxLayoutState& aState)
}
nsresult
nsIFrame::Redraw(nsBoxLayoutState& aState,
const nsRect* aDamageRect)
nsIFrame::Redraw(nsBoxLayoutState& aState)
{
if (aState.PaintingDisabled())
return NS_OK;
nsRect damageRect(0,0,0,0);
if (aDamageRect)
damageRect = *aDamageRect;
else
damageRect = GetVisualOverflowRect();
Invalidate(damageRect);
// nsStackLayout, at least, expects us to repaint descendants even
// if a damage rect is provided
FrameLayerBuilder::InvalidateThebesLayersInSubtree(this);
InvalidateFrameSubtree();
return NS_OK;
}

View File

@ -97,7 +97,7 @@ nsDeckFrame::IndexChanged()
return;
// redraw
InvalidateOverflowRect();
InvalidateFrame();
// hide the currently showing box
nsIFrame* currentBox = GetSelectedBox();

View File

@ -593,6 +593,10 @@ NS_IMETHODIMP nsImageBoxFrame::FrameChanged(imgIRequest *aRequest,
imgIContainer *aContainer,
const nsIntRect *aDirtyRect)
{
if ((0 == mRect.width) || (0 == mRect.height)) {
return NS_OK;
}
nsBoxLayoutState state(PresContext());
this->Redraw(state);

View File

@ -197,9 +197,7 @@ nsListBoxLayout::LayoutInternal(nsIFrame* aBox, nsBoxLayoutState& aState)
// before them then redraw everything under the inserted rows. The inserted
// rows will automatically be redrawn because the were marked dirty on insertion.
if (redrawStart > -1) {
nsRect bounds(aBox->GetRect());
nsRect tempRect(0,redrawStart,bounds.width, bounds.height - redrawStart);
aBox->Redraw(aState, &tempRect);
aBox->Redraw(aState);
}
return NS_OK;

View File

@ -814,14 +814,6 @@ nsMenuPopupFrame::HidePopup(bool aDeselectMenu, nsPopupState aNewState)
}
}
void
nsMenuPopupFrame::InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY, nsIFrame* aForChild,
uint32_t aFlags)
{
InvalidateRoot(aDamageRect + nsPoint(aX, aY), aFlags);
}
void
nsMenuPopupFrame::GetLayoutFlags(uint32_t& aFlags)
{

View File

@ -160,10 +160,6 @@ public:
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
virtual void InvalidateInternal(const nsRect& aDamageRect,
nscoord aX, nscoord aY, nsIFrame* aForChild,
uint32_t aFlags);
// returns true if the popup is a panel with the noautohide attribute set to
// true. These panels do not roll up automatically.
bool IsNoAutoHide() const;

View File

@ -696,7 +696,7 @@ nsSliderFrame::CurrentPositionChanged(nsPresContext* aPresContext,
thumbFrame->SetRect(newThumbRect);
// Redraw the scrollbar
InvalidateWithFlags(clientRect, aImmediateRedraw ? INVALIDATE_IMMEDIATE : 0);
//InvalidateFrame();
mCurPos = curPos;

View File

@ -364,14 +364,7 @@ nsStackLayout::Layout(nsIFrame* aBox, nsBoxLayoutState& aState)
// if the new and old rect intersect meaning we just moved a little
// then just redraw the union. If they don't intersect (meaning
// we moved a good distance) redraw both separately.
if (childRectNoMargin.Intersects(oldRect)) {
nsRect u;
u.UnionRect(oldRect, childRectNoMargin);
aBox->Redraw(aState, &u);
} else {
aBox->Redraw(aState, &oldRect);
aBox->Redraw(aState, &childRectNoMargin);
}
aBox->Redraw(aState);
}
}

View File

@ -644,7 +644,7 @@ nsTreeBodyFrame::Invalidate()
if (mUpdateBatchNest)
return NS_OK;
InvalidateOverflowRect();
InvalidateFrame();
return NS_OK;
}
@ -670,7 +670,7 @@ nsTreeBodyFrame::InvalidateColumn(nsITreeColumn* aCol)
// When false then column is out of view
if (OffsetForHorzScroll(columnRect, true))
nsIFrame::Invalidate(columnRect);
InvalidateFrame();
return NS_OK;
}
@ -690,8 +690,7 @@ nsTreeBodyFrame::InvalidateRow(int32_t aIndex)
if (aIndex < 0 || aIndex > mPageLength)
return NS_OK;
nsRect rowRect(mInnerBox.x, mInnerBox.y+mRowHeight*aIndex, mInnerBox.width, mRowHeight);
nsLeafBoxFrame::Invalidate(rowRect);
InvalidateFrame();
return NS_OK;
}
@ -721,7 +720,7 @@ nsTreeBodyFrame::InvalidateCell(int32_t aIndex, nsITreeColumn* aCol)
NS_ENSURE_SUCCESS(rv, rv);
if (OffsetForHorzScroll(cellRect, true))
nsIFrame::Invalidate(cellRect);
InvalidateFrame();
return NS_OK;
}
@ -753,8 +752,7 @@ nsTreeBodyFrame::InvalidateRange(int32_t aStart, int32_t aEnd)
}
#endif
nsRect rangeRect(mInnerBox.x, mInnerBox.y+mRowHeight*(aStart-mTopRowIndex), mInnerBox.width, mRowHeight*(aEnd-aStart+1));
nsIFrame::Invalidate(rangeRect);
InvalidateFrame();
return NS_OK;
}
@ -790,14 +788,7 @@ nsTreeBodyFrame::InvalidateColumnRange(int32_t aStart, int32_t aEnd, nsITreeColu
}
#endif
nsRect rangeRect;
nsresult rv = col->GetRect(this,
mInnerBox.y+mRowHeight*(aStart-mTopRowIndex),
mRowHeight*(aEnd-aStart+1),
&rangeRect);
NS_ENSURE_SUCCESS(rv, rv);
nsIFrame::Invalidate(rangeRect);
InvalidateFrame();
return NS_OK;
}

View File

@ -84,7 +84,6 @@ nsViewManager::nsViewManager()
// NOTE: we use a zeroing operator new, so all data members are
// assumed to be cleared here.
mHasPendingUpdates = false;
mHasPendingWidgetGeometryChanges = false;
mRecursiveRefreshPending = false;
}
@ -485,7 +484,6 @@ void
nsViewManager::PostPendingUpdate()
{
nsViewManager* rootVM = RootViewManager();
rootVM->mHasPendingUpdates = true;
rootVM->mHasPendingWidgetGeometryChanges = true;
if (rootVM->mPresShell) {
rootVM->mPresShell->ScheduleViewManagerFlush();
@ -1206,20 +1204,16 @@ nsViewManager::ProcessPendingUpdates()
if (IsRefreshDriverPaintingEnabled()) {
mPresShell->GetPresContext()->RefreshDriver()->RevokeViewManagerFlush();
if (mHasPendingUpdates) {
mHasPendingUpdates = false;
// Flush things like reflows and plugin widget geometry updates by
// calling WillPaint on observer presShells.
if (mPresShell) {
CallWillPaintOnObservers(true);
}
ProcessPendingUpdatesForView(mRootView, true);
CallDidPaintOnObserver();
// Flush things like reflows and plugin widget geometry updates by
// calling WillPaint on observer presShells.
if (mPresShell) {
CallWillPaintOnObservers(true);
}
} else if (mHasPendingUpdates) {
ProcessPendingUpdatesForView(mRootView, true);
mHasPendingUpdates = false;
CallDidPaintOnObserver();
} else {
ProcessPendingUpdatesForView(mRootView, true);
}
}

View File

@ -203,7 +203,6 @@ private:
// Use IsPainting() and SetPainting() to access mPainting.
bool mPainting;
bool mRecursiveRefreshPending;
bool mHasPendingUpdates;
bool mHasPendingWidgetGeometryChanges;
bool mInScroll;

View File

@ -566,7 +566,7 @@ nsNativeTheme::Notify(nsITimer* aTimer)
for (uint32_t index = 0; index < count; index++) {
nsIFrame* frame = mAnimatedContentList[index]->GetPrimaryFrame();
if (frame) {
frame->InvalidateOverflowRect();
frame->InvalidateFrame();
}
}