Bug 235264. Clean up invalidation to go through a single nsIFrame::Invalidate function and take account of 'outline' where necessary. r+sr=dbaron

This commit is contained in:
roc+%cs.cmu.edu 2004-03-10 03:09:05 +00:00
Родитель 8e639b5bd9
Коммит 0651f4e7ae
65 изменённых файлов: 352 добавлений и 742 удалений

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

@ -9492,6 +9492,10 @@ DoApplyRenderingChangeToTree(nsIPresContext* aPresContext,
nsFrameManager* aFrameManager,
nsChangeHint aChange);
/**
* @param aBoundsRect returns the bounds enclosing the areas covered by aFrame and its childre
* This rect is relative to aFrame's parent
*/
static void
UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame,
nsIViewManager* aViewManager, nsFrameManager* aFrameManager,
@ -9510,10 +9514,7 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame,
}
}
nsRect bounds = aFrame->GetRect();
nsPoint parentOffset(bounds.x, bounds.y);
bounds.x = 0;
bounds.y = 0;
nsRect bounds = aFrame->GetOutlineRect();
// now do children of frame
PRInt32 listIndex = 0;
@ -9542,8 +9543,9 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame,
}
childList = aFrame->GetAdditionalChildListName(listIndex++);
} while (childList);
aBoundsRect = bounds;
aBoundsRect += parentOffset;
nsPoint parentOffset = aFrame->GetPosition();
aBoundsRect = bounds + parentOffset;
}
static void
@ -9557,38 +9559,20 @@ DoApplyRenderingChangeToTree(nsIPresContext* aPresContext,
"should only be called within ApplyRenderingChangeToTree");
for ( ; aFrame; aFrame = GetNifOrSpecialSibling(aFrameManager, aFrame)) {
// Get the frame's bounding rect
nsRect invalidRect;
nsPoint viewOffset;
// Get view if this frame has one and trigger an update. If the
// frame doesn't have a view, find the nearest containing view
// (adjusting r's coordinate system to reflect the nesting) and
// update there.
nsIView* view = aFrame->GetView();
nsIView* parentView;
if (! view) { // XXX can view have children outside it?
aFrame->GetOffsetFromView(aPresContext, viewOffset, &parentView);
NS_ASSERTION(nsnull != parentView, "no view");
}
nsRect invalidRect;
UpdateViewsForTree(aPresContext, aFrame, aViewManager, aFrameManager,
invalidRect, aChange);
if (! view && (aChange & nsChangeHint_RepaintFrame)) { // if frame has view, will already be invalidated
// XXX Instead of calling this we should really be calling
// Invalidate on on the nsFrame (which does this)
// XXX This rect inflation should be done when the rects are
// being accumulated in UpdateViewsForTree, not in
// DoApplyRenderingChangeToTree
const nsStyleOutline* outline = aFrame->GetStyleOutline();
nscoord width;
outline->GetOutlineWidth(width);
if (width > 0) {
invalidRect.Inflate(width, width);
}
if (!aFrame->HasView()
&& (aChange & nsChangeHint_RepaintFrame)) {
// if frame has view, will already be invalidated
invalidRect -= aFrame->GetPosition();
invalidRect += viewOffset;
aViewManager->UpdateView(parentView, invalidRect, NS_VMREFRESH_NO_SYNC);
aFrame->Invalidate(invalidRect, PR_FALSE);
}
}
}

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

@ -221,10 +221,6 @@ NS_IMETHODIMP nsImageLoader::FrameChanged(imgIContainer *aContainer,
void
nsImageLoader::RedrawDirtyFrame(const nsRect* aDamageRect)
{
// Determine damaged area and tell view manager to redraw it
nsPoint offset;
nsIView* view;
// 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
@ -234,8 +230,8 @@ nsImageLoader::RedrawDirtyFrame(const nsRect* aDamageRect)
// Invalidate the entire frame
// XXX We really only need to invalidate the client area of the frame...
nsRect bounds = mFrame->GetRect();
bounds.x = bounds.y = 0;
nsRect bounds(nsPoint(0, 0), mFrame->GetSize());
// XXX this should be ok, but there is some crappy ass bug causing it not to work
// XXX seems related to the "body fixup rule" dealing with the canvas and body frames...
@ -259,22 +255,6 @@ nsImageLoader::RedrawDirtyFrame(const nsRect* aDamageRect)
}
#endif
if ((bounds.width > 0) && (bounds.height > 0)) {
// XXX We should tell the frame the damage area and let it invalidate
// itself. Add some API calls to nsIFrame to allow a caller to invalidate
// parts of the frame...
if (mFrame->HasView()) {
view = mFrame->GetView();
} else {
mFrame->GetOffsetFromView(mPresContext, offset, &view);
bounds.x += offset.x;
bounds.y += offset.y;
}
nsIViewManager* vm = view->GetViewManager();
if (vm) {
vm->UpdateView(view, bounds, NS_VMREFRESH_NO_SYNC);
}
}
mFrame->Invalidate(bounds, PR_FALSE);
}

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

@ -4817,10 +4817,9 @@ PresShell::UnsuppressAndInvalidate()
mPaintingSuppressed = PR_FALSE;
nsIFrame* rootFrame = FrameManager()->GetRootFrame();
if (rootFrame) {
nsRect rect = rootFrame->GetRect();
if (!rect.IsEmpty()) {
((nsFrame*)rootFrame)->Invalidate(mPresContext, rect, PR_FALSE);
}
// let's assume that outline on a root frame is not supported
nsRect rect(nsPoint(0, 0), rootFrame->GetSize());
rootFrame->Invalidate(rect, PR_FALSE);
}
if (ourWindow)

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

@ -1010,13 +1010,26 @@ public:
*/
NS_IMETHOD IsPercentageBase(PRBool& aBase) const = 0;
// Invalidate part of the frame by asking the view manager to repaint.
// aDamageRect is in the frame's local coordinate space
/**
* 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. But it must be within the bounds of the view enclosing this frame.
* 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, PRBool aImmediate = PR_FALSE) const;
// XXX deprecated, remove once we've fixed all callers
void Invalidate(nsIPresContext* aPresContext,
const nsRect& aDamageRect, PRBool aImmediate = PR_FALSE) const
{ Invalidate(aDamageRect, aImmediate); }
/**
* Computes a rect that includes this frame's outline. The returned rect is
* relative to this frame's origin.
*
* @param if nonnull, we record whether this rect is bigger than the frame's bounds
* @return the rect relative to this frame's origin
*/
nsRect GetOutlineRect(PRBool* aAnyOutline = nsnull) const;
/** Selection related calls
*/

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

@ -221,10 +221,6 @@ NS_IMETHODIMP nsImageLoader::FrameChanged(imgIContainer *aContainer,
void
nsImageLoader::RedrawDirtyFrame(const nsRect* aDamageRect)
{
// Determine damaged area and tell view manager to redraw it
nsPoint offset;
nsIView* view;
// 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
@ -234,8 +230,8 @@ nsImageLoader::RedrawDirtyFrame(const nsRect* aDamageRect)
// Invalidate the entire frame
// XXX We really only need to invalidate the client area of the frame...
nsRect bounds = mFrame->GetRect();
bounds.x = bounds.y = 0;
nsRect bounds(nsPoint(0, 0), mFrame->GetSize());
// XXX this should be ok, but there is some crappy ass bug causing it not to work
// XXX seems related to the "body fixup rule" dealing with the canvas and body frames...
@ -259,22 +255,6 @@ nsImageLoader::RedrawDirtyFrame(const nsRect* aDamageRect)
}
#endif
if ((bounds.width > 0) && (bounds.height > 0)) {
// XXX We should tell the frame the damage area and let it invalidate
// itself. Add some API calls to nsIFrame to allow a caller to invalidate
// parts of the frame...
if (mFrame->HasView()) {
view = mFrame->GetView();
} else {
mFrame->GetOffsetFromView(mPresContext, offset, &view);
bounds.x += offset.x;
bounds.y += offset.y;
}
nsIViewManager* vm = view->GetViewManager();
if (vm) {
vm->UpdateView(view, bounds, NS_VMREFRESH_NO_SYNC);
}
}
mFrame->Invalidate(bounds, PR_FALSE);
}

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

@ -96,15 +96,6 @@ nsButtonFrameRenderer::isDisabled()
return PR_FALSE;
}
void
nsButtonFrameRenderer::Redraw(nsIPresContext* aPresContext)
{
nsRect rect = mFrame->GetRect();
rect.x = 0;
rect.y = 0;
mFrame->Invalidate(aPresContext, rect, PR_FALSE);
}
void
nsButtonFrameRenderer::PaintButton (nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,

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

@ -102,8 +102,6 @@ public:
virtual void SetStyleContext(PRInt32 aIndex, nsStyleContext* aStyleContext);
virtual void ReResolveStyles(nsIPresContext* aPresContext);
virtual void Redraw(nsIPresContext* aPresContext);
virtual nsIFrame* GetFrame();
protected:

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

@ -530,11 +530,12 @@ nsComboboxControlFrame::SetFocus(PRBool aOn, PRBool 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(mPresContext, nsRect(0,0,mRect.width,mRect.height), PR_TRUE);
Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_TRUE);
// Make sure the content area gets updated for where the dropdown was
// This is only needed for embedding, the focus may go to
// the chrome that is not part of the Gecko system (Bug 83493)
// XXX this is rather inefficient
nsIViewManager* vm = GetPresContext()->GetViewManager();
if (vm) {
vm->UpdateAllViews(NS_VMREFRESH_NO_SYNC);

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

@ -95,25 +95,6 @@ nsFormControlHelper::~nsFormControlHelper()
MOZ_COUNT_DTOR(nsFormControlHelper);
}
void nsFormControlHelper::ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame * aFrame)
{
if (!aFrame) {
return;
}
nsIView * view;
nsPoint pnt;
aFrame->GetOffsetFromView(aPresContext, pnt, &view);
nsRect rect = aFrame->GetRect();
rect.x = pnt.x;
rect.y = pnt.y;
if (view) {
nsIViewManager* viewMgr = view->GetViewManager();
if (viewMgr) {
viewMgr->UpdateView(view, rect, NS_VMREFRESH_NO_SYNC);
}
}
}
void nsFormControlHelper::PlatformToDOMLineBreaks(nsString &aString)
{
// Windows linebreaks: Map CRLF to LF:

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

@ -104,8 +104,6 @@ public:
nsIFormControlFrame * aFrame,
nsIFontMetrics** aFontMet);
static void ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame * aFrame);
// Map platform line endings (CR, CRLF, LF) to DOM line endings (LF)
static void PlatformToDOMLineBreaks(nsString &aString);

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

@ -166,7 +166,7 @@ NS_IMETHODIMP
nsGfxCheckboxControlFrame::OnChecked(nsIPresContext* aPresContext,
PRBool aChecked)
{
nsFormControlHelper::ForceDrawFrame(aPresContext, this);
Invalidate(GetOutlineRect(), PR_FALSE);
return aChecked;
}

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

@ -239,7 +239,7 @@ NS_IMETHODIMP
nsGfxRadioControlFrame::OnChecked(nsIPresContext* aPresContext,
PRBool aChecked)
{
nsFormControlHelper::ForceDrawFrame(aPresContext, this);
Invalidate(GetOutlineRect(), PR_FALSE);
return NS_OK;
}

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

@ -415,7 +415,8 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
// See if it's targeted at us
nsHTMLReflowCommand *command = aReflowState.path->mReflowCommand;
if (command) {
Invalidate(aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
// I'm not sure what exactly this Invalidate is for
Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
nsReflowType reflowType;
command->GetType(reflowType);

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

@ -276,10 +276,6 @@ nsImageControlFrame::HandleEvent(nsIPresContext* aPresContext,
void
nsImageControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
{
/*if (aRepaint) {
nsRect rect(0, 0, mRect.width, mRect.height);
Invalidate(rect, PR_TRUE);
}*/
}
void

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

@ -2124,7 +2124,7 @@ nsListControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
}
// Make sure the SelectArea frame gets painted
Invalidate(mPresContext, nsRect(0,0,mRect.width,mRect.height), PR_TRUE);
Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_TRUE);
}
void nsListControlFrame::ComboboxFocusSet()
@ -2995,7 +2995,7 @@ nsListControlFrame::MouseMove(nsIDOMEvent* aMouseEvent)
// XXX this shouldn't be needed, but other places in this code do it
// and if we don't do this, invalidation doesn't happen when we move out
// of the top-level window. We should track this down and fix it --- roc
Invalidate(mPresContext, nsRect(0,0,mRect.width,mRect.height), PR_TRUE);
Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_TRUE);
}
} else {// XXX - temporary until we get drag events
if (mButtonDown) {
@ -3503,7 +3503,7 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
REFLOW_DEBUG_MSG2(" After: %d\n", newIndex);
// Make sure the SelectArea frame gets painted
Invalidate(mPresContext, nsRect(0,0,mRect.width,mRect.height), PR_TRUE);
Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_TRUE);
} else {
REFLOW_DEBUG_MSG(" After: SKIPPED it\n");

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

@ -2307,10 +2307,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
printf("%p invalidate 6 (%d, %d, %d, %d)\n",
this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height);
#endif
if (!dirtyRect.IsEmpty()) {
Invalidate(aState.mPresContext, dirtyRect);
}
Invalidate(dirtyRect);
} else {
if (oldCombinedArea.width != lineCombinedArea.width) {
nsRect dirtyRect;
@ -2329,9 +2326,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
printf("%p invalidate 7 (%d, %d, %d, %d)\n",
this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height);
#endif
if (!dirtyRect.IsEmpty()) {
Invalidate(aState.mPresContext, dirtyRect);
}
Invalidate(dirtyRect);
}
if (oldCombinedArea.height != lineCombinedArea.height) {
nsRect dirtyRect;
@ -2350,9 +2345,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
printf("%p invalidate 8 (%d, %d, %d, %d)\n",
this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height);
#endif
if (!dirtyRect.IsEmpty()) {
Invalidate(aState.mPresContext, dirtyRect);
}
Invalidate(dirtyRect);
}
}
}
@ -2467,9 +2460,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
if (aLine->IsForceInvalidate())
printf(" dirty line is %p\n", NS_STATIC_CAST(void*, aLine.get());
#endif
if (!dirtyRect.IsEmpty()) {
Invalidate(aState.mPresContext, dirtyRect);
}
Invalidate(dirtyRect);
}
}
@ -2558,15 +2549,15 @@ nsBlockFrame::PullFrameFrom(nsBlockReflowState& aState,
else {
// Free up the fromLine now that it's empty
// Its bounds might need to be redrawn, though.
if (aDamageDeletedLines && !fromLine->mBounds.IsEmpty()) {
Invalidate(aState.mPresContext, fromLine->mBounds);
// XXX WHY do we invalidate the bounds AND the combined area? doesn't
// the combined area always enclose the bounds?
if (aDamageDeletedLines) {
Invalidate(fromLine->mBounds);
}
if (aFromLine.next() != end_lines())
aFromLine.next()->MarkPreviousMarginDirty();
nsRect combinedArea = fromLine->GetCombinedArea();
if (!combinedArea.IsEmpty())
Invalidate(aState.mPresContext, combinedArea);
Invalidate(fromLine->GetCombinedArea());
aFromContainer.erase(aFromLine);
aState.FreeLineBox(fromLine);
}
@ -2615,16 +2606,10 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState,
{
NS_PRECONDITION(aDY != 0, "why slide a line nowhere?");
nsRect lineCombinedArea(aLine->GetCombinedArea());
PRBool doInvalidate = !lineCombinedArea.IsEmpty();
if (doInvalidate)
Invalidate(aState.mPresContext, lineCombinedArea);
Invalidate(aLine->GetCombinedArea());
// Adjust line state
aLine->SlideBy(aDY);
if (doInvalidate) {
Invalidate(aState.mPresContext, aLine->GetCombinedArea());
}
Invalidate(aLine->GetCombinedArea());
// Adjust the frames in the line
nsIFrame* kid = aLine->mFirstChild;
@ -4796,9 +4781,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
printf("%p invalidate 10 (%d, %d, %d, %d)\n",
this, lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height);
#endif
if (!lineCombinedArea.IsEmpty()) {
Invalidate(aPresContext, lineCombinedArea);
}
Invalidate(lineCombinedArea);
cur->Destroy(presShell);
// If we're removing a line, ReflowDirtyLines isn't going to
@ -6279,10 +6262,9 @@ nsBlockFrame::RenumberListsFor(nsIPresContext* aPresContext,
if (changed) {
kidRenumberedABullet = PR_TRUE;
nsRect damageRect = listItem->mBullet->GetRect();
damageRect.x = damageRect.y = 0;
if (damageRect.width > 0 || damageRect.height > 0)
listItem->mBullet->Invalidate(aPresContext, damageRect);
// Invalidate the bullet content area since it may look different now
nsRect damageRect(nsPoint(0, 0), listItem->mBullet->GetSize());
listItem->mBullet->Invalidate(damageRect);
}
}

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

@ -1721,24 +1721,10 @@ NS_IMETHODIMP nsBulletFrame::OnDataAvailable(imgIRequest *aRequest,
gfxIImageFrame *aFrame,
const nsRect *aRect)
{
if (!aRect) return NS_ERROR_NULL_POINTER;
NS_ENSURE_TRUE(mPresContext, NS_ERROR_UNEXPECTED); // Why are we bothering?
// XXX Should we do anything here if an error occured in the decode?
nsRect r(*aRect);
// XXX what if this frame ever has a padding or border?
float p2t;
p2t = mPresContext->PixelsToTwips();
r.x = NSIntPixelsToTwips(r.x, p2t);
r.y = NSIntPixelsToTwips(r.y, p2t);
r.width = NSIntPixelsToTwips(r.width, p2t);
r.height = NSIntPixelsToTwips(r.height, p2t);
Invalidate(mPresContext, r, PR_FALSE);
// 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), PR_FALSE);
return NS_OK;
}
@ -1768,18 +1754,9 @@ NS_IMETHODIMP nsBulletFrame::FrameChanged(imgIContainer *aContainer,
gfxIImageFrame *aNewFrame,
nsRect *aDirtyRect)
{
NS_ENSURE_TRUE(mPresContext, NS_ERROR_UNEXPECTED); // Why are we bothering?
nsRect r(*aDirtyRect);
float p2t;
p2t = mPresContext->PixelsToTwips();
r.x = NSIntPixelsToTwips(r.x, p2t);
r.y = NSIntPixelsToTwips(r.y, p2t);
r.width = NSIntPixelsToTwips(r.width, p2t);
r.height = NSIntPixelsToTwips(r.height, p2t);
Invalidate(mPresContext, r, PR_FALSE);
// 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), PR_FALSE);
return NS_OK;
}

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

@ -1045,10 +1045,11 @@ nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
PositionChildViews(aPresContext, aKidFrame);
}
// We also need to redraw 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.
// 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.mOverflowArea);
}

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

@ -114,8 +114,6 @@ static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
#include "nsICaret.h"
#include "nsILineIterator.h"
// [HACK] Foward Declarations
void ForceDrawFrame(nsIPresContext* aPresContext, nsFrame * aFrame);
//non Hack prototypes
#if 0
@ -763,18 +761,18 @@ nsFrame::SetOverflowClipRect(nsIRenderingContext& aRenderingContext)
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect, clipState);
}
/********************************************************
* Refreshes each content's frame
/********************************************************
* Refreshes this frame and all child frames that are frames for aContent
*********************************************************/
static void RefreshAllContentFrames(nsIPresContext* aPresContext, nsIFrame * aFrame, nsIContent * aContent)
static void RefreshAllContentFrames(nsIFrame* aFrame, nsIContent* aContent)
{
if (aFrame->GetContent() == aContent) {
ForceDrawFrame(aPresContext, (nsFrame *)aFrame);
aFrame->Invalidate(aFrame->GetOutlineRect(), PR_FALSE);
}
aFrame = aFrame->GetFirstChild(nsnull);
while (aFrame) {
RefreshAllContentFrames(aPresContext, aFrame, aContent);
RefreshAllContentFrames(aFrame, aContent);
aFrame = aFrame->GetNextSibling();
}
}
@ -783,32 +781,6 @@ static void RefreshAllContentFrames(nsIPresContext* aPresContext, nsIFrame * aFr
* Refreshes each content's frame
*********************************************************/
/**
*
*/
void ForceDrawFrame(nsIPresContext* aPresContext, nsFrame * aFrame)//, PRBool)
{
if (!aFrame) {
return;
}
nsIView * view;
nsPoint pnt;
aFrame->GetOffsetFromView(aPresContext, pnt, &view);
nsRect rect = aFrame->GetRect();
rect.x = pnt.x;
rect.y = pnt.y;
if (view) {
nsIViewManager* viewMgr = view->GetViewManager();
if (viewMgr) {
viewMgr->UpdateView(view, rect, 0);
}
//viewMgr->UpdateView(view, rect, NS_VMREFRESH_DOUBLE_BUFFER | NS_VMREFRESH_IMMEDIATE);
}
}
NS_IMETHODIMP
nsFrame::Paint(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
@ -2520,6 +2492,31 @@ nsIFrame::Invalidate(const nsRect& aDamageRect,
}
}
nsRect
nsIFrame::GetOutlineRect(PRBool* aAnyOutline) const
{
const nsStyleOutline* outline = GetStyleOutline();
PRUint8 outlineStyle = outline->GetOutlineStyle();
nsRect r(0, 0, mRect.width, mRect.height);
PRBool anyOutline = PR_FALSE;
if (outlineStyle != NS_STYLE_BORDER_STYLE_NONE) {
nscoord width;
#ifdef DEBUG
PRBool result =
#endif
outline->GetOutlineWidth(width);
NS_ASSERTION(result, "GetOutlineWidth had no cached outline width");
if (width > 0) {
r.Inflate(width, width);
anyOutline = PR_TRUE;
}
}
if (aAnyOutline) {
*aAnyOutline = anyOutline;
}
return r;
}
void
nsFrame::CheckInvalidateSizeChange(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
@ -2545,37 +2542,30 @@ nsFrame::CheckInvalidateSizeChange(nsIPresContext* aPresContext,
// Currently we actually paint 'outline' inside the element so this code
// isn't strictly necessary. But we're trying to get ready to switch to
// CSS2 compliance.
const nsStyleOutline* outline = GetStyleOutline();
PRUint8 outlineStyle = outline->GetOutlineStyle();
if (outlineStyle != NS_STYLE_BORDER_STYLE_NONE
&& outlineStyle != NS_STYLE_BORDER_STYLE_HIDDEN) {
nscoord width;
outline->GetOutlineWidth(width);
if (width > 0) {
nsRect r(0, 0, mRect.width, mRect.height);
r.Inflate(width, width);
Invalidate(aPresContext, r);
PRBool anyOutline;
nsRect r = GetOutlineRect(&anyOutline);
if (anyOutline) {
Invalidate(r);
return;
}
}
// Invalidate the old frame if the frame has borders. Those borders
// Invalidate the old frame borders if the frame has borders. Those borders
// may be moving.
const nsStyleBorder* border = GetStyleBorder();
if (border->IsBorderSideVisible(NS_SIDE_LEFT)
|| border->IsBorderSideVisible(NS_SIDE_RIGHT)
|| border->IsBorderSideVisible(NS_SIDE_TOP)
|| border->IsBorderSideVisible(NS_SIDE_BOTTOM)) {
Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height));
Invalidate(nsRect(0, 0, mRect.width, mRect.height));
return;
}
// Invalidate the old frame if the frame has a background
// Invalidate the old frame background if the frame has a background
// whose position depends on the size of the frame
const nsStyleBackground* background = GetStyleBackground();
if (background->mBackgroundFlags &
(NS_STYLE_BG_X_POSITION_PERCENT | NS_STYLE_BG_Y_POSITION_PERCENT)) {
Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height));
Invalidate(nsRect(0, 0, mRect.width, mRect.height));
return;
}
}
@ -3002,39 +2992,16 @@ nsFrame::SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange, PRBool a
}
else
RemoveStateBits(NS_FRAME_SELECTED_CONTENT);
nsRect frameRect = GetRect();
nsRect rect(0, 0, frameRect.width, frameRect.height);
if (!rect.IsEmpty()) {
Invalidate(aPresContext, rect, PR_FALSE);
}
// repaint this frame's outline area.
// In CSS3 selection can change the outline style! and border and content too
Invalidate(GetOutlineRect(), PR_FALSE);
if (GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN)
{
RefreshAllContentFrames(aPresContext, this, mContent);
RefreshAllContentFrames(this, mContent);
}
#if 0
if (aRange) {
//lets see if the range contains us, if so we must redraw!
nsCOMPtr<nsIDOMNode> endNode;
nsCOMPtr<nsIDOMNode> startNode;
aRange->GetEndParent(getter_AddRefs(endNode));
aRange->GetStartParent(getter_AddRefs(startNode));
nsIContent* content = GetContent();
nsCOMPtr<nsIDOMNode> thisNode;
thisNode = do_QueryInterface(content);
//we must tell the siblings about the set selected call
//since the getprimaryframe call is done with this content node.
if (thisNode != startNode && thisNode != endNode)
{ //whole node selected
nsIFrame *frame = GetNextSibling();
while (frame)
{
frame->SetSelected(aRange,aSelected,eSpreadDown);
frame = frame->GetNextSibling();
}
}
}
#endif
#ifdef IBMBIDI
PRInt32 start, end;
nsIFrame* frame = GetNextSibling();
@ -3046,6 +3013,7 @@ nsFrame::SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange, PRBool a
}
}
#endif // IBMBIDI
return NS_OK;
}

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

@ -393,14 +393,9 @@ nsSubDocumentFrame::Reflow(nsIPresContext* aPresContext,
// Determine if we need to repaint our border, background or outline
CheckInvalidateSizeChange(aPresContext, aDesiredSize, aReflowState);
{
// Invalidate the frame
nsRect frameRect = GetRect();
nsRect rect(0, 0, frameRect.width, frameRect.height);
if (!rect.IsEmpty()) {
Invalidate(aPresContext, rect, PR_FALSE);
}
}
// Invalidate the frame contents
nsRect rect(nsPoint(0, 0), GetSize());
Invalidate(rect, PR_FALSE);
if (!aPresContext->IsPaginated()) {
nsCOMPtr<nsIDocShell> docShell;

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

@ -350,7 +350,9 @@ CanvasFrame::RemoveFrame(nsIPresContext* aPresContext,
} else if (aOldFrame == mFrames.FirstChild()) {
// It's our one and only child frame
// Damage the area occupied by the deleted frame
Invalidate(aPresContext, aOldFrame->GetRect(), PR_FALSE);
// The child of the canvas probably can't have an outline, but why bother
// thinking about that?
Invalidate(aOldFrame->GetOutlineRect() + aOldFrame->GetPosition(), PR_FALSE);
// Remove the frame and destroy it
mFrames.DestroyFrame(aPresContext, aOldFrame);
@ -593,15 +595,14 @@ CanvasFrame::Reflow(nsIPresContext* aPresContext,
}
// Complete the reflow and position and size the child frame
nsRect rect(kidReflowState.mComputedMargin.left, kidReflowState.mComputedMargin.top,
kidDesiredSize.width, kidDesiredSize.height);
FinishReflowChild(kidFrame, aPresContext, &kidReflowState, kidDesiredSize, rect.x, rect.y, 0);
FinishReflowChild(kidFrame, aPresContext, &kidReflowState, kidDesiredSize,
kidReflowState.mComputedMargin.left,
kidReflowState.mComputedMargin.top, 0);
// If the child frame was just inserted, then we're responsible for making sure
// it repaints
if (isDirtyChildReflow) {
// Damage the area occupied by the deleted frame
Invalidate(aPresContext, rect, PR_FALSE);
Invalidate(kidFrame->GetOutlineRect() + kidFrame->GetPosition(), PR_FALSE);
}
// Return our desired size

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

@ -1010,13 +1010,26 @@ public:
*/
NS_IMETHOD IsPercentageBase(PRBool& aBase) const = 0;
// Invalidate part of the frame by asking the view manager to repaint.
// aDamageRect is in the frame's local coordinate space
/**
* 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. But it must be within the bounds of the view enclosing this frame.
* 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, PRBool aImmediate = PR_FALSE) const;
// XXX deprecated, remove once we've fixed all callers
void Invalidate(nsIPresContext* aPresContext,
const nsRect& aDamageRect, PRBool aImmediate = PR_FALSE) const
{ Invalidate(aDamageRect, aImmediate); }
/**
* Computes a rect that includes this frame's outline. The returned rect is
* relative to this frame's origin.
*
* @param if nonnull, we record whether this rect is bigger than the frame's bounds
* @return the rect relative to this frame's origin
*/
nsRect GetOutlineRect(PRBool* aAnyOutline = nsnull) const;
/** Selection related calls
*/

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

@ -565,9 +565,8 @@ nsImageFrame::OnDataAvailable(imgIRequest *aRequest,
// handle iconLoads first...
if (HandleIconLoads(aRequest, PR_FALSE)) {
if (!aRect->IsEmpty()) {
Invalidate(GetPresContext(), *aRect, PR_FALSE);
}
// Image changed, invalidate
Invalidate(*aRect, PR_FALSE);
return NS_OK;
}
@ -591,10 +590,8 @@ nsImageFrame::OnDataAvailable(imgIRequest *aRequest,
nsRect r = ConvertPxRectToTwips(*aRect);
mTransform.TransformCoord(&r.x, &r.y, &r.width, &r.height);
if (!r.IsEmpty()) {
Invalidate(GetPresContext(), r, PR_FALSE);
}
// Invalidate updated image
Invalidate(r, PR_FALSE);
return NS_OK;
}
@ -647,9 +644,8 @@ nsImageFrame::OnStopDecode(imgIRequest *aRequest,
} else {
nsSize s = GetSize();
nsRect r(0, 0, s.width, s.height);
if (!r.IsEmpty()) {
Invalidate(presContext, r, PR_FALSE);
}
// Update border+content to account for image change
Invalidate(r, PR_FALSE);
}
}
}
@ -682,9 +678,8 @@ nsImageFrame::FrameChanged(imgIContainer *aContainer,
nsRect r = ConvertPxRectToTwips(*aDirtyRect);
mTransform.TransformCoord(&r.x, &r.y, &r.width, &r.height);
if (!r.IsEmpty()) {
Invalidate(GetPresContext(), r, PR_FALSE);
}
// Update border+content to account for image change
Invalidate(r, PR_FALSE);
return NS_OK;
}
@ -1928,7 +1923,8 @@ void nsImageFrame::InvalidateIcon()
NSIntPixelsToTwips(ICON_SIZE+ICON_PADDING, p2t),
NSIntPixelsToTwips(ICON_SIZE+ICON_PADDING, p2t));
NS_ASSERTION(!rect.IsEmpty(), "icon rect cannot be empty!");
Invalidate(presContext, rect, PR_FALSE);
// update image area
Invalidate(rect, PR_FALSE);
}
NS_IMPL_ISUPPORTS1(nsImageFrame::IconLoad, nsIObserver)

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

@ -1045,7 +1045,7 @@ nsImageMap::ChangeFocus(nsIDOMEvent* aEvent, PRBool aFocus) {
if (NS_SUCCEEDED(presShell->GetPresContext(getter_AddRefs(presContext))) && presContext) {
nsRect dmgRect;
area->GetRect(presContext, dmgRect);
Invalidate(presContext, imgFrame, dmgRect);
imgFrame->Invalidate(dmgRect, PR_TRUE);
}
}
}
@ -1064,28 +1064,6 @@ nsImageMap::HandleEvent(nsIDOMEvent* aEvent)
return NS_OK;
}
nsresult
nsImageMap::Invalidate(nsIPresContext* aPresContext, nsIFrame* aFrame, nsRect& aRect)
{
PRUint32 flags = NS_VMREFRESH_IMMEDIATE;
nsIView* view;
nsRect damageRect(aRect);
if (aFrame->HasView()) {
view = aFrame->GetView();
}
else {
nsPoint offset;
aFrame->GetOffsetFromView(aPresContext, offset, &view);
NS_ASSERTION(view, "no view");
damageRect += offset;
}
view->GetViewManager()->UpdateView(view, damageRect, flags);
return NS_OK;
}
void
nsImageMap::Destroy(void)
{

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

@ -126,7 +126,6 @@ protected:
nsresult AddArea(nsIContent* aArea);
nsresult ChangeFocus(nsIDOMEvent* aEvent, PRBool aFocus);
nsresult Invalidate(nsIPresContext* aPresContext, nsIFrame* aFrame, nsRect& aRect);
void MaybeUpdateAreas(nsIContent *aContent);

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

@ -339,13 +339,9 @@ NS_IMETHODIMP nsBlinkTimer::Notify(nsITimer *timer)
FrameData* frameData = (FrameData*) mFrames.ElementAt(i);
// Determine damaged area and tell view manager to redraw it
nsPoint offset;
nsRect bounds = frameData->mFrame->GetRect();
nsIView* view;
frameData->mFrame->GetOffsetFromView(frameData->mPresContext, offset, &view);
bounds.x = offset.x;
bounds.y = offset.y;
view->GetViewManager()->UpdateView(view, bounds, 0);
// blink doesn't blink outline ... I hope
nsRect bounds(nsPoint(0, 0), frameData->mFrame->GetSize());
frameData->mFrame->Invalidate(bounds, PR_FALSE);
}
return NS_OK;
}
@ -3656,11 +3652,10 @@ nsTextFrame::SetSelected(nsIPresContext* aPresContext,
}
}
if (found){ //if range contains this frame...
nsRect frameRect = GetRect();
nsRect rect(0, 0, frameRect.width, frameRect.height);
if (!rect.IsEmpty())
Invalidate(aPresContext, rect, PR_FALSE);
// ForceDrawFrame(this);
// Selection might change our border, content and outline appearance
// But textframes can't have an outline. So just use the simple
// bounds
Invalidate(nsRect(0, 0, mRect.width, mRect.height), PR_FALSE);
}
if (aSpread == eSpreadDown)
{
@ -5493,9 +5488,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext,
maxFrameWidth = PR_MAX(maxFrameWidth, mRect.width) + onePixel;
maxFrameHeight = PR_MAX(maxFrameHeight, mRect.height);
nsRect damage(0,0,maxFrameWidth,maxFrameHeight);
if (!damage.IsEmpty()) {
Invalidate(aPresContext, damage);
}
Invalidate(damage);
/*}*/

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

@ -320,9 +320,7 @@ ViewportFrame::Reflow(nsIPresContext* aPresContext,
(eReflowReason_Resize == aReflowState.reason) ||
(eReflowReason_StyleChange == aReflowState.reason)) {
nsRect damageRect(0, 0, aDesiredSize.width, aDesiredSize.height);
if (!damageRect.IsEmpty()) {
Invalidate(aPresContext, damageRect, PR_FALSE);
}
Invalidate(damageRect, PR_FALSE);
}
NS_FRAME_TRACE_REFLOW_OUT("ViewportFrame::Reflow", aStatus);

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

@ -2307,10 +2307,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
printf("%p invalidate 6 (%d, %d, %d, %d)\n",
this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height);
#endif
if (!dirtyRect.IsEmpty()) {
Invalidate(aState.mPresContext, dirtyRect);
}
Invalidate(dirtyRect);
} else {
if (oldCombinedArea.width != lineCombinedArea.width) {
nsRect dirtyRect;
@ -2329,9 +2326,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
printf("%p invalidate 7 (%d, %d, %d, %d)\n",
this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height);
#endif
if (!dirtyRect.IsEmpty()) {
Invalidate(aState.mPresContext, dirtyRect);
}
Invalidate(dirtyRect);
}
if (oldCombinedArea.height != lineCombinedArea.height) {
nsRect dirtyRect;
@ -2350,9 +2345,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
printf("%p invalidate 8 (%d, %d, %d, %d)\n",
this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height);
#endif
if (!dirtyRect.IsEmpty()) {
Invalidate(aState.mPresContext, dirtyRect);
}
Invalidate(dirtyRect);
}
}
}
@ -2467,9 +2460,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
if (aLine->IsForceInvalidate())
printf(" dirty line is %p\n", NS_STATIC_CAST(void*, aLine.get());
#endif
if (!dirtyRect.IsEmpty()) {
Invalidate(aState.mPresContext, dirtyRect);
}
Invalidate(dirtyRect);
}
}
@ -2558,15 +2549,15 @@ nsBlockFrame::PullFrameFrom(nsBlockReflowState& aState,
else {
// Free up the fromLine now that it's empty
// Its bounds might need to be redrawn, though.
if (aDamageDeletedLines && !fromLine->mBounds.IsEmpty()) {
Invalidate(aState.mPresContext, fromLine->mBounds);
// XXX WHY do we invalidate the bounds AND the combined area? doesn't
// the combined area always enclose the bounds?
if (aDamageDeletedLines) {
Invalidate(fromLine->mBounds);
}
if (aFromLine.next() != end_lines())
aFromLine.next()->MarkPreviousMarginDirty();
nsRect combinedArea = fromLine->GetCombinedArea();
if (!combinedArea.IsEmpty())
Invalidate(aState.mPresContext, combinedArea);
Invalidate(fromLine->GetCombinedArea());
aFromContainer.erase(aFromLine);
aState.FreeLineBox(fromLine);
}
@ -2615,16 +2606,10 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState,
{
NS_PRECONDITION(aDY != 0, "why slide a line nowhere?");
nsRect lineCombinedArea(aLine->GetCombinedArea());
PRBool doInvalidate = !lineCombinedArea.IsEmpty();
if (doInvalidate)
Invalidate(aState.mPresContext, lineCombinedArea);
Invalidate(aLine->GetCombinedArea());
// Adjust line state
aLine->SlideBy(aDY);
if (doInvalidate) {
Invalidate(aState.mPresContext, aLine->GetCombinedArea());
}
Invalidate(aLine->GetCombinedArea());
// Adjust the frames in the line
nsIFrame* kid = aLine->mFirstChild;
@ -4796,9 +4781,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
printf("%p invalidate 10 (%d, %d, %d, %d)\n",
this, lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height);
#endif
if (!lineCombinedArea.IsEmpty()) {
Invalidate(aPresContext, lineCombinedArea);
}
Invalidate(lineCombinedArea);
cur->Destroy(presShell);
// If we're removing a line, ReflowDirtyLines isn't going to
@ -6279,10 +6262,9 @@ nsBlockFrame::RenumberListsFor(nsIPresContext* aPresContext,
if (changed) {
kidRenumberedABullet = PR_TRUE;
nsRect damageRect = listItem->mBullet->GetRect();
damageRect.x = damageRect.y = 0;
if (damageRect.width > 0 || damageRect.height > 0)
listItem->mBullet->Invalidate(aPresContext, damageRect);
// Invalidate the bullet content area since it may look different now
nsRect damageRect(nsPoint(0, 0), listItem->mBullet->GetSize());
listItem->mBullet->Invalidate(damageRect);
}
}

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

@ -1721,24 +1721,10 @@ NS_IMETHODIMP nsBulletFrame::OnDataAvailable(imgIRequest *aRequest,
gfxIImageFrame *aFrame,
const nsRect *aRect)
{
if (!aRect) return NS_ERROR_NULL_POINTER;
NS_ENSURE_TRUE(mPresContext, NS_ERROR_UNEXPECTED); // Why are we bothering?
// XXX Should we do anything here if an error occured in the decode?
nsRect r(*aRect);
// XXX what if this frame ever has a padding or border?
float p2t;
p2t = mPresContext->PixelsToTwips();
r.x = NSIntPixelsToTwips(r.x, p2t);
r.y = NSIntPixelsToTwips(r.y, p2t);
r.width = NSIntPixelsToTwips(r.width, p2t);
r.height = NSIntPixelsToTwips(r.height, p2t);
Invalidate(mPresContext, r, PR_FALSE);
// 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), PR_FALSE);
return NS_OK;
}
@ -1768,18 +1754,9 @@ NS_IMETHODIMP nsBulletFrame::FrameChanged(imgIContainer *aContainer,
gfxIImageFrame *aNewFrame,
nsRect *aDirtyRect)
{
NS_ENSURE_TRUE(mPresContext, NS_ERROR_UNEXPECTED); // Why are we bothering?
nsRect r(*aDirtyRect);
float p2t;
p2t = mPresContext->PixelsToTwips();
r.x = NSIntPixelsToTwips(r.x, p2t);
r.y = NSIntPixelsToTwips(r.y, p2t);
r.width = NSIntPixelsToTwips(r.width, p2t);
r.height = NSIntPixelsToTwips(r.height, p2t);
Invalidate(mPresContext, r, PR_FALSE);
// 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), PR_FALSE);
return NS_OK;
}

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

@ -1045,10 +1045,11 @@ nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
PositionChildViews(aPresContext, aKidFrame);
}
// We also need to redraw 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.
// 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.mOverflowArea);
}

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

@ -114,8 +114,6 @@ static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
#include "nsICaret.h"
#include "nsILineIterator.h"
// [HACK] Foward Declarations
void ForceDrawFrame(nsIPresContext* aPresContext, nsFrame * aFrame);
//non Hack prototypes
#if 0
@ -763,18 +761,18 @@ nsFrame::SetOverflowClipRect(nsIRenderingContext& aRenderingContext)
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect, clipState);
}
/********************************************************
* Refreshes each content's frame
/********************************************************
* Refreshes this frame and all child frames that are frames for aContent
*********************************************************/
static void RefreshAllContentFrames(nsIPresContext* aPresContext, nsIFrame * aFrame, nsIContent * aContent)
static void RefreshAllContentFrames(nsIFrame* aFrame, nsIContent* aContent)
{
if (aFrame->GetContent() == aContent) {
ForceDrawFrame(aPresContext, (nsFrame *)aFrame);
aFrame->Invalidate(aFrame->GetOutlineRect(), PR_FALSE);
}
aFrame = aFrame->GetFirstChild(nsnull);
while (aFrame) {
RefreshAllContentFrames(aPresContext, aFrame, aContent);
RefreshAllContentFrames(aFrame, aContent);
aFrame = aFrame->GetNextSibling();
}
}
@ -783,32 +781,6 @@ static void RefreshAllContentFrames(nsIPresContext* aPresContext, nsIFrame * aFr
* Refreshes each content's frame
*********************************************************/
/**
*
*/
void ForceDrawFrame(nsIPresContext* aPresContext, nsFrame * aFrame)//, PRBool)
{
if (!aFrame) {
return;
}
nsIView * view;
nsPoint pnt;
aFrame->GetOffsetFromView(aPresContext, pnt, &view);
nsRect rect = aFrame->GetRect();
rect.x = pnt.x;
rect.y = pnt.y;
if (view) {
nsIViewManager* viewMgr = view->GetViewManager();
if (viewMgr) {
viewMgr->UpdateView(view, rect, 0);
}
//viewMgr->UpdateView(view, rect, NS_VMREFRESH_DOUBLE_BUFFER | NS_VMREFRESH_IMMEDIATE);
}
}
NS_IMETHODIMP
nsFrame::Paint(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
@ -2520,6 +2492,31 @@ nsIFrame::Invalidate(const nsRect& aDamageRect,
}
}
nsRect
nsIFrame::GetOutlineRect(PRBool* aAnyOutline) const
{
const nsStyleOutline* outline = GetStyleOutline();
PRUint8 outlineStyle = outline->GetOutlineStyle();
nsRect r(0, 0, mRect.width, mRect.height);
PRBool anyOutline = PR_FALSE;
if (outlineStyle != NS_STYLE_BORDER_STYLE_NONE) {
nscoord width;
#ifdef DEBUG
PRBool result =
#endif
outline->GetOutlineWidth(width);
NS_ASSERTION(result, "GetOutlineWidth had no cached outline width");
if (width > 0) {
r.Inflate(width, width);
anyOutline = PR_TRUE;
}
}
if (aAnyOutline) {
*aAnyOutline = anyOutline;
}
return r;
}
void
nsFrame::CheckInvalidateSizeChange(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
@ -2545,37 +2542,30 @@ nsFrame::CheckInvalidateSizeChange(nsIPresContext* aPresContext,
// Currently we actually paint 'outline' inside the element so this code
// isn't strictly necessary. But we're trying to get ready to switch to
// CSS2 compliance.
const nsStyleOutline* outline = GetStyleOutline();
PRUint8 outlineStyle = outline->GetOutlineStyle();
if (outlineStyle != NS_STYLE_BORDER_STYLE_NONE
&& outlineStyle != NS_STYLE_BORDER_STYLE_HIDDEN) {
nscoord width;
outline->GetOutlineWidth(width);
if (width > 0) {
nsRect r(0, 0, mRect.width, mRect.height);
r.Inflate(width, width);
Invalidate(aPresContext, r);
PRBool anyOutline;
nsRect r = GetOutlineRect(&anyOutline);
if (anyOutline) {
Invalidate(r);
return;
}
}
// Invalidate the old frame if the frame has borders. Those borders
// Invalidate the old frame borders if the frame has borders. Those borders
// may be moving.
const nsStyleBorder* border = GetStyleBorder();
if (border->IsBorderSideVisible(NS_SIDE_LEFT)
|| border->IsBorderSideVisible(NS_SIDE_RIGHT)
|| border->IsBorderSideVisible(NS_SIDE_TOP)
|| border->IsBorderSideVisible(NS_SIDE_BOTTOM)) {
Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height));
Invalidate(nsRect(0, 0, mRect.width, mRect.height));
return;
}
// Invalidate the old frame if the frame has a background
// Invalidate the old frame background if the frame has a background
// whose position depends on the size of the frame
const nsStyleBackground* background = GetStyleBackground();
if (background->mBackgroundFlags &
(NS_STYLE_BG_X_POSITION_PERCENT | NS_STYLE_BG_Y_POSITION_PERCENT)) {
Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height));
Invalidate(nsRect(0, 0, mRect.width, mRect.height));
return;
}
}
@ -3002,39 +2992,16 @@ nsFrame::SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange, PRBool a
}
else
RemoveStateBits(NS_FRAME_SELECTED_CONTENT);
nsRect frameRect = GetRect();
nsRect rect(0, 0, frameRect.width, frameRect.height);
if (!rect.IsEmpty()) {
Invalidate(aPresContext, rect, PR_FALSE);
}
// repaint this frame's outline area.
// In CSS3 selection can change the outline style! and border and content too
Invalidate(GetOutlineRect(), PR_FALSE);
if (GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN)
{
RefreshAllContentFrames(aPresContext, this, mContent);
RefreshAllContentFrames(this, mContent);
}
#if 0
if (aRange) {
//lets see if the range contains us, if so we must redraw!
nsCOMPtr<nsIDOMNode> endNode;
nsCOMPtr<nsIDOMNode> startNode;
aRange->GetEndParent(getter_AddRefs(endNode));
aRange->GetStartParent(getter_AddRefs(startNode));
nsIContent* content = GetContent();
nsCOMPtr<nsIDOMNode> thisNode;
thisNode = do_QueryInterface(content);
//we must tell the siblings about the set selected call
//since the getprimaryframe call is done with this content node.
if (thisNode != startNode && thisNode != endNode)
{ //whole node selected
nsIFrame *frame = GetNextSibling();
while (frame)
{
frame->SetSelected(aRange,aSelected,eSpreadDown);
frame = frame->GetNextSibling();
}
}
}
#endif
#ifdef IBMBIDI
PRInt32 start, end;
nsIFrame* frame = GetNextSibling();
@ -3046,6 +3013,7 @@ nsFrame::SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange, PRBool a
}
}
#endif // IBMBIDI
return NS_OK;
}

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

@ -350,7 +350,9 @@ CanvasFrame::RemoveFrame(nsIPresContext* aPresContext,
} else if (aOldFrame == mFrames.FirstChild()) {
// It's our one and only child frame
// Damage the area occupied by the deleted frame
Invalidate(aPresContext, aOldFrame->GetRect(), PR_FALSE);
// The child of the canvas probably can't have an outline, but why bother
// thinking about that?
Invalidate(aOldFrame->GetOutlineRect() + aOldFrame->GetPosition(), PR_FALSE);
// Remove the frame and destroy it
mFrames.DestroyFrame(aPresContext, aOldFrame);
@ -593,15 +595,14 @@ CanvasFrame::Reflow(nsIPresContext* aPresContext,
}
// Complete the reflow and position and size the child frame
nsRect rect(kidReflowState.mComputedMargin.left, kidReflowState.mComputedMargin.top,
kidDesiredSize.width, kidDesiredSize.height);
FinishReflowChild(kidFrame, aPresContext, &kidReflowState, kidDesiredSize, rect.x, rect.y, 0);
FinishReflowChild(kidFrame, aPresContext, &kidReflowState, kidDesiredSize,
kidReflowState.mComputedMargin.left,
kidReflowState.mComputedMargin.top, 0);
// If the child frame was just inserted, then we're responsible for making sure
// it repaints
if (isDirtyChildReflow) {
// Damage the area occupied by the deleted frame
Invalidate(aPresContext, rect, PR_FALSE);
Invalidate(kidFrame->GetOutlineRect() + kidFrame->GetPosition(), PR_FALSE);
}
// Return our desired size

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

@ -565,9 +565,8 @@ nsImageFrame::OnDataAvailable(imgIRequest *aRequest,
// handle iconLoads first...
if (HandleIconLoads(aRequest, PR_FALSE)) {
if (!aRect->IsEmpty()) {
Invalidate(GetPresContext(), *aRect, PR_FALSE);
}
// Image changed, invalidate
Invalidate(*aRect, PR_FALSE);
return NS_OK;
}
@ -591,10 +590,8 @@ nsImageFrame::OnDataAvailable(imgIRequest *aRequest,
nsRect r = ConvertPxRectToTwips(*aRect);
mTransform.TransformCoord(&r.x, &r.y, &r.width, &r.height);
if (!r.IsEmpty()) {
Invalidate(GetPresContext(), r, PR_FALSE);
}
// Invalidate updated image
Invalidate(r, PR_FALSE);
return NS_OK;
}
@ -647,9 +644,8 @@ nsImageFrame::OnStopDecode(imgIRequest *aRequest,
} else {
nsSize s = GetSize();
nsRect r(0, 0, s.width, s.height);
if (!r.IsEmpty()) {
Invalidate(presContext, r, PR_FALSE);
}
// Update border+content to account for image change
Invalidate(r, PR_FALSE);
}
}
}
@ -682,9 +678,8 @@ nsImageFrame::FrameChanged(imgIContainer *aContainer,
nsRect r = ConvertPxRectToTwips(*aDirtyRect);
mTransform.TransformCoord(&r.x, &r.y, &r.width, &r.height);
if (!r.IsEmpty()) {
Invalidate(GetPresContext(), r, PR_FALSE);
}
// Update border+content to account for image change
Invalidate(r, PR_FALSE);
return NS_OK;
}
@ -1928,7 +1923,8 @@ void nsImageFrame::InvalidateIcon()
NSIntPixelsToTwips(ICON_SIZE+ICON_PADDING, p2t),
NSIntPixelsToTwips(ICON_SIZE+ICON_PADDING, p2t));
NS_ASSERTION(!rect.IsEmpty(), "icon rect cannot be empty!");
Invalidate(presContext, rect, PR_FALSE);
// update image area
Invalidate(rect, PR_FALSE);
}
NS_IMPL_ISUPPORTS1(nsImageFrame::IconLoad, nsIObserver)

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

@ -1045,7 +1045,7 @@ nsImageMap::ChangeFocus(nsIDOMEvent* aEvent, PRBool aFocus) {
if (NS_SUCCEEDED(presShell->GetPresContext(getter_AddRefs(presContext))) && presContext) {
nsRect dmgRect;
area->GetRect(presContext, dmgRect);
Invalidate(presContext, imgFrame, dmgRect);
imgFrame->Invalidate(dmgRect, PR_TRUE);
}
}
}
@ -1064,28 +1064,6 @@ nsImageMap::HandleEvent(nsIDOMEvent* aEvent)
return NS_OK;
}
nsresult
nsImageMap::Invalidate(nsIPresContext* aPresContext, nsIFrame* aFrame, nsRect& aRect)
{
PRUint32 flags = NS_VMREFRESH_IMMEDIATE;
nsIView* view;
nsRect damageRect(aRect);
if (aFrame->HasView()) {
view = aFrame->GetView();
}
else {
nsPoint offset;
aFrame->GetOffsetFromView(aPresContext, offset, &view);
NS_ASSERTION(view, "no view");
damageRect += offset;
}
view->GetViewManager()->UpdateView(view, damageRect, flags);
return NS_OK;
}
void
nsImageMap::Destroy(void)
{

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

@ -126,7 +126,6 @@ protected:
nsresult AddArea(nsIContent* aArea);
nsresult ChangeFocus(nsIDOMEvent* aEvent, PRBool aFocus);
nsresult Invalidate(nsIPresContext* aPresContext, nsIFrame* aFrame, nsRect& aRect);
void MaybeUpdateAreas(nsIContent *aContent);

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

@ -4817,10 +4817,9 @@ PresShell::UnsuppressAndInvalidate()
mPaintingSuppressed = PR_FALSE;
nsIFrame* rootFrame = FrameManager()->GetRootFrame();
if (rootFrame) {
nsRect rect = rootFrame->GetRect();
if (!rect.IsEmpty()) {
((nsFrame*)rootFrame)->Invalidate(mPresContext, rect, PR_FALSE);
}
// let's assume that outline on a root frame is not supported
nsRect rect(nsPoint(0, 0), rootFrame->GetSize());
rootFrame->Invalidate(rect, PR_FALSE);
}
if (ourWindow)

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

@ -339,13 +339,9 @@ NS_IMETHODIMP nsBlinkTimer::Notify(nsITimer *timer)
FrameData* frameData = (FrameData*) mFrames.ElementAt(i);
// Determine damaged area and tell view manager to redraw it
nsPoint offset;
nsRect bounds = frameData->mFrame->GetRect();
nsIView* view;
frameData->mFrame->GetOffsetFromView(frameData->mPresContext, offset, &view);
bounds.x = offset.x;
bounds.y = offset.y;
view->GetViewManager()->UpdateView(view, bounds, 0);
// blink doesn't blink outline ... I hope
nsRect bounds(nsPoint(0, 0), frameData->mFrame->GetSize());
frameData->mFrame->Invalidate(bounds, PR_FALSE);
}
return NS_OK;
}
@ -3656,11 +3652,10 @@ nsTextFrame::SetSelected(nsIPresContext* aPresContext,
}
}
if (found){ //if range contains this frame...
nsRect frameRect = GetRect();
nsRect rect(0, 0, frameRect.width, frameRect.height);
if (!rect.IsEmpty())
Invalidate(aPresContext, rect, PR_FALSE);
// ForceDrawFrame(this);
// Selection might change our border, content and outline appearance
// But textframes can't have an outline. So just use the simple
// bounds
Invalidate(nsRect(0, 0, mRect.width, mRect.height), PR_FALSE);
}
if (aSpread == eSpreadDown)
{
@ -5493,9 +5488,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext,
maxFrameWidth = PR_MAX(maxFrameWidth, mRect.width) + onePixel;
maxFrameHeight = PR_MAX(maxFrameHeight, mRect.height);
nsRect damage(0,0,maxFrameWidth,maxFrameHeight);
if (!damage.IsEmpty()) {
Invalidate(aPresContext, damage);
}
Invalidate(damage);
/*}*/

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

@ -320,9 +320,7 @@ ViewportFrame::Reflow(nsIPresContext* aPresContext,
(eReflowReason_Resize == aReflowState.reason) ||
(eReflowReason_StyleChange == aReflowState.reason)) {
nsRect damageRect(0, 0, aDesiredSize.width, aDesiredSize.height);
if (!damageRect.IsEmpty()) {
Invalidate(aPresContext, damageRect, PR_FALSE);
}
Invalidate(damageRect, PR_FALSE);
}
NS_FRAME_TRACE_REFLOW_OUT("ViewportFrame::Reflow", aStatus);

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

@ -393,14 +393,9 @@ nsSubDocumentFrame::Reflow(nsIPresContext* aPresContext,
// Determine if we need to repaint our border, background or outline
CheckInvalidateSizeChange(aPresContext, aDesiredSize, aReflowState);
{
// Invalidate the frame
nsRect frameRect = GetRect();
nsRect rect(0, 0, frameRect.width, frameRect.height);
if (!rect.IsEmpty()) {
Invalidate(aPresContext, rect, PR_FALSE);
}
}
// Invalidate the frame contents
nsRect rect(nsPoint(0, 0), GetSize());
Invalidate(rect, PR_FALSE);
if (!aPresContext->IsPaginated()) {
nsCOMPtr<nsIDocShell> docShell;

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

@ -96,15 +96,6 @@ nsButtonFrameRenderer::isDisabled()
return PR_FALSE;
}
void
nsButtonFrameRenderer::Redraw(nsIPresContext* aPresContext)
{
nsRect rect = mFrame->GetRect();
rect.x = 0;
rect.y = 0;
mFrame->Invalidate(aPresContext, rect, PR_FALSE);
}
void
nsButtonFrameRenderer::PaintButton (nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,

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

@ -102,8 +102,6 @@ public:
virtual void SetStyleContext(PRInt32 aIndex, nsStyleContext* aStyleContext);
virtual void ReResolveStyles(nsIPresContext* aPresContext);
virtual void Redraw(nsIPresContext* aPresContext);
virtual nsIFrame* GetFrame();
protected:

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

@ -530,11 +530,12 @@ nsComboboxControlFrame::SetFocus(PRBool aOn, PRBool 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(mPresContext, nsRect(0,0,mRect.width,mRect.height), PR_TRUE);
Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_TRUE);
// Make sure the content area gets updated for where the dropdown was
// This is only needed for embedding, the focus may go to
// the chrome that is not part of the Gecko system (Bug 83493)
// XXX this is rather inefficient
nsIViewManager* vm = GetPresContext()->GetViewManager();
if (vm) {
vm->UpdateAllViews(NS_VMREFRESH_NO_SYNC);

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

@ -95,25 +95,6 @@ nsFormControlHelper::~nsFormControlHelper()
MOZ_COUNT_DTOR(nsFormControlHelper);
}
void nsFormControlHelper::ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame * aFrame)
{
if (!aFrame) {
return;
}
nsIView * view;
nsPoint pnt;
aFrame->GetOffsetFromView(aPresContext, pnt, &view);
nsRect rect = aFrame->GetRect();
rect.x = pnt.x;
rect.y = pnt.y;
if (view) {
nsIViewManager* viewMgr = view->GetViewManager();
if (viewMgr) {
viewMgr->UpdateView(view, rect, NS_VMREFRESH_NO_SYNC);
}
}
}
void nsFormControlHelper::PlatformToDOMLineBreaks(nsString &aString)
{
// Windows linebreaks: Map CRLF to LF:

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

@ -104,8 +104,6 @@ public:
nsIFormControlFrame * aFrame,
nsIFontMetrics** aFontMet);
static void ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame * aFrame);
// Map platform line endings (CR, CRLF, LF) to DOM line endings (LF)
static void PlatformToDOMLineBreaks(nsString &aString);

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

@ -166,7 +166,7 @@ NS_IMETHODIMP
nsGfxCheckboxControlFrame::OnChecked(nsIPresContext* aPresContext,
PRBool aChecked)
{
nsFormControlHelper::ForceDrawFrame(aPresContext, this);
Invalidate(GetOutlineRect(), PR_FALSE);
return aChecked;
}

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

@ -239,7 +239,7 @@ NS_IMETHODIMP
nsGfxRadioControlFrame::OnChecked(nsIPresContext* aPresContext,
PRBool aChecked)
{
nsFormControlHelper::ForceDrawFrame(aPresContext, this);
Invalidate(GetOutlineRect(), PR_FALSE);
return NS_OK;
}

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

@ -415,7 +415,8 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
// See if it's targeted at us
nsHTMLReflowCommand *command = aReflowState.path->mReflowCommand;
if (command) {
Invalidate(aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
// I'm not sure what exactly this Invalidate is for
Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
nsReflowType reflowType;
command->GetType(reflowType);

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

@ -276,10 +276,6 @@ nsImageControlFrame::HandleEvent(nsIPresContext* aPresContext,
void
nsImageControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
{
/*if (aRepaint) {
nsRect rect(0, 0, mRect.width, mRect.height);
Invalidate(rect, PR_TRUE);
}*/
}
void

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

@ -2124,7 +2124,7 @@ nsListControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
}
// Make sure the SelectArea frame gets painted
Invalidate(mPresContext, nsRect(0,0,mRect.width,mRect.height), PR_TRUE);
Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_TRUE);
}
void nsListControlFrame::ComboboxFocusSet()
@ -2995,7 +2995,7 @@ nsListControlFrame::MouseMove(nsIDOMEvent* aMouseEvent)
// XXX this shouldn't be needed, but other places in this code do it
// and if we don't do this, invalidation doesn't happen when we move out
// of the top-level window. We should track this down and fix it --- roc
Invalidate(mPresContext, nsRect(0,0,mRect.width,mRect.height), PR_TRUE);
Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_TRUE);
}
} else {// XXX - temporary until we get drag events
if (mButtonDown) {
@ -3503,7 +3503,7 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
REFLOW_DEBUG_MSG2(" After: %d\n", newIndex);
// Make sure the SelectArea frame gets painted
Invalidate(mPresContext, nsRect(0,0,mRect.width,mRect.height), PR_TRUE);
Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_TRUE);
} else {
REFLOW_DEBUG_MSG(" After: SKIPPED it\n");

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

@ -9492,6 +9492,10 @@ DoApplyRenderingChangeToTree(nsIPresContext* aPresContext,
nsFrameManager* aFrameManager,
nsChangeHint aChange);
/**
* @param aBoundsRect returns the bounds enclosing the areas covered by aFrame and its childre
* This rect is relative to aFrame's parent
*/
static void
UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame,
nsIViewManager* aViewManager, nsFrameManager* aFrameManager,
@ -9510,10 +9514,7 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame,
}
}
nsRect bounds = aFrame->GetRect();
nsPoint parentOffset(bounds.x, bounds.y);
bounds.x = 0;
bounds.y = 0;
nsRect bounds = aFrame->GetOutlineRect();
// now do children of frame
PRInt32 listIndex = 0;
@ -9542,8 +9543,9 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame,
}
childList = aFrame->GetAdditionalChildListName(listIndex++);
} while (childList);
aBoundsRect = bounds;
aBoundsRect += parentOffset;
nsPoint parentOffset = aFrame->GetPosition();
aBoundsRect = bounds + parentOffset;
}
static void
@ -9557,38 +9559,20 @@ DoApplyRenderingChangeToTree(nsIPresContext* aPresContext,
"should only be called within ApplyRenderingChangeToTree");
for ( ; aFrame; aFrame = GetNifOrSpecialSibling(aFrameManager, aFrame)) {
// Get the frame's bounding rect
nsRect invalidRect;
nsPoint viewOffset;
// Get view if this frame has one and trigger an update. If the
// frame doesn't have a view, find the nearest containing view
// (adjusting r's coordinate system to reflect the nesting) and
// update there.
nsIView* view = aFrame->GetView();
nsIView* parentView;
if (! view) { // XXX can view have children outside it?
aFrame->GetOffsetFromView(aPresContext, viewOffset, &parentView);
NS_ASSERTION(nsnull != parentView, "no view");
}
nsRect invalidRect;
UpdateViewsForTree(aPresContext, aFrame, aViewManager, aFrameManager,
invalidRect, aChange);
if (! view && (aChange & nsChangeHint_RepaintFrame)) { // if frame has view, will already be invalidated
// XXX Instead of calling this we should really be calling
// Invalidate on on the nsFrame (which does this)
// XXX This rect inflation should be done when the rects are
// being accumulated in UpdateViewsForTree, not in
// DoApplyRenderingChangeToTree
const nsStyleOutline* outline = aFrame->GetStyleOutline();
nscoord width;
outline->GetOutlineWidth(width);
if (width > 0) {
invalidRect.Inflate(width, width);
}
if (!aFrame->HasView()
&& (aChange & nsChangeHint_RepaintFrame)) {
// if frame has view, will already be invalidated
invalidRect -= aFrame->GetPosition();
invalidRect += viewOffset;
aViewManager->UpdateView(parentView, invalidRect, NS_VMREFRESH_NO_SYNC);
aFrame->Invalidate(invalidRect, PR_FALSE);
}
}
}

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

@ -526,9 +526,8 @@ nsTableCellFrame::SetSelected(nsIPresContext* aPresContext,
PRBool tableCellSelectionMode;
result = frameSelection->GetTableCellSelection(&tableCellSelectionMode);
if (NS_SUCCEEDED(result) && tableCellSelectionMode) {
nsRect frameRect = GetRect();
nsRect rect(0, 0, frameRect.width, frameRect.height);
Invalidate(aPresContext, rect, PR_FALSE);
// Selection can affect content, border and outline
Invalidate(GetOutlineRect(), PR_FALSE);
}
}
return NS_OK;
@ -887,7 +886,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
kidOrigin.x, kidOrigin.y, 0, aStatus);
SetLastBlockHeight(kidSize.height);
if (isStyleChanged) {
Invalidate(aPresContext, mRect);
Invalidate(GetOutlineRect(), PR_FALSE);
}
#if defined DEBUG_TABLE_REFLOW_TIMING

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

@ -1587,12 +1587,11 @@ nsTableFrame::AdjustSiblingsAfterReflow(nsIPresContext* aPresContext,
}
}
// Invalidate the area we offset. Note that we only repaint within
// XXX It would be better to bitblt the row frames and not repaint,
// but we don't have such a view manager function yet...
// Invalidate the area we offset.
if (NS_UNCONSTRAINEDSIZE != yInvalid) {
nsRect dirtyRect(0, yInvalid, mRect.width, mRect.height - yInvalid);
Invalidate(aPresContext, dirtyRect);
// XXX what if some of the cells have outlines?
Invalidate(dirtyRect);
}
return NS_OK;
@ -1667,12 +1666,11 @@ ProcessRowInserted(nsIPresContext* aPresContext,
rowFrame->SetFirstInserted(PR_FALSE);
if (aInvalidate) {
// damage the table from the 1st row inserted to the end of the table
nsRect damageRect = aTableFrame.GetRect();
nscoord damageY = rgFrame->GetPosition().y + rowFrame->GetPosition().y;
nsRect damageRect(0, damageY,
aTableFrame.GetSize().width, aNewHeight - damageY);
damageRect.y += rgFrame->GetPosition().y + rowFrame->GetPosition().y;
damageRect.height = aNewHeight - damageRect.y;
aTableFrame.Invalidate(aPresContext, damageRect);
aTableFrame.Invalidate(damageRect);
aTableFrame.SetRowInserted(PR_FALSE);
}
return; // found it, so leave
@ -2105,7 +2103,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
if (oldOverflowArea) {
damage.UnionRect(damage, *oldOverflowArea);
}
Invalidate(aPresContext, damage);
Invalidate(damage);
} else {
// use the old overflow area
nsRect* oldOverflowArea = GetOverflowAreaProperty(aPresContext);
@ -3000,7 +2998,7 @@ nsTableFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
dirtyRect.y = PR_MIN(oldKidRect.YMost(), kidRect.YMost());
dirtyRect.width = mRect.width;
dirtyRect.height = PR_MAX(oldKidRect.YMost(), kidRect.YMost()) - dirtyRect.y;
Invalidate(aPresContext, dirtyRect);
Invalidate(dirtyRect);
}
// Adjust the row groups that follow
@ -3297,10 +3295,10 @@ nsTableFrame::ReflowChildren(nsIPresContext* aPresContext,
nsRect kidRect = kidFrame->GetRect();
if (haveReflowedRowGroup) {
if (kidRect.y != aReflowState.y) {
Invalidate(aPresContext, kidRect); // invalidate the old position
Invalidate(kidRect); // invalidate the old position
kidRect.y = aReflowState.y;
kidFrame->SetRect(kidRect); // move to the new position
Invalidate(aPresContext, kidRect); // invalidate the new position
Invalidate(kidRect); // invalidate the new position
}
}
aReflowState.y += cellSpacingY + kidRect.height;

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

@ -628,7 +628,7 @@ nsTableOuterFrame::InvalidateDamage(nsIPresContext* aPresContext,
damage.UnionRect(damage, *aOldOverflowArea);
}
}
Invalidate(aPresContext, damage);
Invalidate(damage);
}
nscoord

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

@ -1313,7 +1313,7 @@ nsTableRowFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
dirtyRect.height = mRect.height;
ConsiderChildOverflow(aPresContext, aDesiredSize.mOverflowArea, cellFrame);
dirtyRect.UnionRect(dirtyRect, aDesiredSize.mOverflowArea);
Invalidate(aPresContext, dirtyRect);
Invalidate(dirtyRect);
}
}
else { // we dont realign vertical but we need to update the overflow area

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

@ -1719,9 +1719,7 @@ nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
// repaint the entire row
// XXX Improve this so the row knows it should bitblt (or repaint) those
// cells that change position...
if (!kidRect.IsEmpty()) {
Invalidate(aPresContext, kidRect);
}
Invalidate(kidRect);
// Invalidate the area we're offseting. Note that we only repaint within
// our existing frame bounds.
@ -1730,7 +1728,7 @@ nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
if (kidRect.YMost() < mRect.height) {
nsRect dirtyRect(0, kidRect.YMost(),
mRect.width, mRect.height - kidRect.YMost());
Invalidate(aPresContext, dirtyRect);
Invalidate(dirtyRect);
}
// Adjust the frames that follow
@ -1760,7 +1758,7 @@ nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
// 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(aPresContext, dirtyRect);
Invalidate(dirtyRect);
}
else {
// need to recover the OverflowArea

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

@ -526,9 +526,8 @@ nsTableCellFrame::SetSelected(nsIPresContext* aPresContext,
PRBool tableCellSelectionMode;
result = frameSelection->GetTableCellSelection(&tableCellSelectionMode);
if (NS_SUCCEEDED(result) && tableCellSelectionMode) {
nsRect frameRect = GetRect();
nsRect rect(0, 0, frameRect.width, frameRect.height);
Invalidate(aPresContext, rect, PR_FALSE);
// Selection can affect content, border and outline
Invalidate(GetOutlineRect(), PR_FALSE);
}
}
return NS_OK;
@ -887,7 +886,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
kidOrigin.x, kidOrigin.y, 0, aStatus);
SetLastBlockHeight(kidSize.height);
if (isStyleChanged) {
Invalidate(aPresContext, mRect);
Invalidate(GetOutlineRect(), PR_FALSE);
}
#if defined DEBUG_TABLE_REFLOW_TIMING

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

@ -1587,12 +1587,11 @@ nsTableFrame::AdjustSiblingsAfterReflow(nsIPresContext* aPresContext,
}
}
// Invalidate the area we offset. Note that we only repaint within
// XXX It would be better to bitblt the row frames and not repaint,
// but we don't have such a view manager function yet...
// Invalidate the area we offset.
if (NS_UNCONSTRAINEDSIZE != yInvalid) {
nsRect dirtyRect(0, yInvalid, mRect.width, mRect.height - yInvalid);
Invalidate(aPresContext, dirtyRect);
// XXX what if some of the cells have outlines?
Invalidate(dirtyRect);
}
return NS_OK;
@ -1667,12 +1666,11 @@ ProcessRowInserted(nsIPresContext* aPresContext,
rowFrame->SetFirstInserted(PR_FALSE);
if (aInvalidate) {
// damage the table from the 1st row inserted to the end of the table
nsRect damageRect = aTableFrame.GetRect();
nscoord damageY = rgFrame->GetPosition().y + rowFrame->GetPosition().y;
nsRect damageRect(0, damageY,
aTableFrame.GetSize().width, aNewHeight - damageY);
damageRect.y += rgFrame->GetPosition().y + rowFrame->GetPosition().y;
damageRect.height = aNewHeight - damageRect.y;
aTableFrame.Invalidate(aPresContext, damageRect);
aTableFrame.Invalidate(damageRect);
aTableFrame.SetRowInserted(PR_FALSE);
}
return; // found it, so leave
@ -2105,7 +2103,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
if (oldOverflowArea) {
damage.UnionRect(damage, *oldOverflowArea);
}
Invalidate(aPresContext, damage);
Invalidate(damage);
} else {
// use the old overflow area
nsRect* oldOverflowArea = GetOverflowAreaProperty(aPresContext);
@ -3000,7 +2998,7 @@ nsTableFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
dirtyRect.y = PR_MIN(oldKidRect.YMost(), kidRect.YMost());
dirtyRect.width = mRect.width;
dirtyRect.height = PR_MAX(oldKidRect.YMost(), kidRect.YMost()) - dirtyRect.y;
Invalidate(aPresContext, dirtyRect);
Invalidate(dirtyRect);
}
// Adjust the row groups that follow
@ -3297,10 +3295,10 @@ nsTableFrame::ReflowChildren(nsIPresContext* aPresContext,
nsRect kidRect = kidFrame->GetRect();
if (haveReflowedRowGroup) {
if (kidRect.y != aReflowState.y) {
Invalidate(aPresContext, kidRect); // invalidate the old position
Invalidate(kidRect); // invalidate the old position
kidRect.y = aReflowState.y;
kidFrame->SetRect(kidRect); // move to the new position
Invalidate(aPresContext, kidRect); // invalidate the new position
Invalidate(kidRect); // invalidate the new position
}
}
aReflowState.y += cellSpacingY + kidRect.height;

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

@ -628,7 +628,7 @@ nsTableOuterFrame::InvalidateDamage(nsIPresContext* aPresContext,
damage.UnionRect(damage, *aOldOverflowArea);
}
}
Invalidate(aPresContext, damage);
Invalidate(damage);
}
nscoord

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

@ -1313,7 +1313,7 @@ nsTableRowFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
dirtyRect.height = mRect.height;
ConsiderChildOverflow(aPresContext, aDesiredSize.mOverflowArea, cellFrame);
dirtyRect.UnionRect(dirtyRect, aDesiredSize.mOverflowArea);
Invalidate(aPresContext, dirtyRect);
Invalidate(dirtyRect);
}
}
else { // we dont realign vertical but we need to update the overflow area

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

@ -1719,9 +1719,7 @@ nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
// repaint the entire row
// XXX Improve this so the row knows it should bitblt (or repaint) those
// cells that change position...
if (!kidRect.IsEmpty()) {
Invalidate(aPresContext, kidRect);
}
Invalidate(kidRect);
// Invalidate the area we're offseting. Note that we only repaint within
// our existing frame bounds.
@ -1730,7 +1728,7 @@ nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
if (kidRect.YMost() < mRect.height) {
nsRect dirtyRect(0, kidRect.YMost(),
mRect.width, mRect.height - kidRect.YMost());
Invalidate(aPresContext, dirtyRect);
Invalidate(dirtyRect);
}
// Adjust the frames that follow
@ -1760,7 +1758,7 @@ nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
// 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(aPresContext, dirtyRect);
Invalidate(dirtyRect);
}
else {
// need to recover the OverflowArea

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

@ -1093,11 +1093,6 @@ nsBox::Redraw(nsBoxLayoutState& aState,
return NS_OK;
}
PRBool suppressed = PR_FALSE;
presContext->PresShell()->IsPaintingSuppressed(&suppressed);
if (suppressed)
return NS_OK; // Don't redraw. Painting is still suppressed.
nsIFrame* frame = nsnull;
GetFrame(&frame);
@ -1109,24 +1104,15 @@ nsBox::Redraw(nsBoxLayoutState& aState,
// Checks to see if the damaged rect should be infalted
// to include the outline
// XXX This makes NO SENSE. if the damage rect is just a small part of
// this frame's rect then adding the outline width doesn't make any sense.
nscoord width;
frame->GetStyleOutline()->GetOutlineWidth(width);
if (width > 0) {
damageRect.Inflate(width, width);
}
PRUint32 flags = aImmediate ? NS_VMREFRESH_IMMEDIATE : NS_VMREFRESH_NO_SYNC;
nsIView *view;
if (frame->HasView()) {
view = frame->GetView();
} else {
nsPoint offset;
frame->GetOffsetFromView(presContext, offset, &view);
NS_BOX_ASSERTION(this, nsnull != view, "no view");
damageRect += offset;
}
view->GetViewManager()->UpdateView(view, damageRect, flags);
frame->Invalidate(damageRect, aImmediate);
return NS_OK;
}

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

@ -1413,25 +1413,6 @@ nsListBoxBodyFrame::GetListItemNextSibling(nsIContent* aListItem, nsIContent** a
aSiblingIndex = -1; // no match, so there is no next sibling
}
void
nsListBoxBodyFrame::ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame * aFrame)
{
if (aFrame == nsnull) {
return;
}
nsIView * view;
nsPoint pnt;
aFrame->GetOffsetFromView(aPresContext, pnt, &view);
nsRect rect = aFrame->GetRect();
rect.x = pnt.x;
rect.y = pnt.y;
if (view) {
nsIViewManager* viewMgr = view->GetViewManager();
if (viewMgr)
viewMgr->UpdateView(view, rect, NS_VMREFRESH_IMMEDIATE);
}
}
//////////////////////////////////////////////////////////////////////////
///// nsListboxScrollPortFrame

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

@ -128,8 +128,6 @@ public:
void GetListItemContentAt(PRInt32 aIndex, nsIContent** aContent);
void GetListItemNextSibling(nsIContent* aListItem, nsIContent** aContent, PRInt32& aSiblingIndex);
static void ForceDrawFrame ( nsIPresContext* aPresContext, nsIFrame * aFrame ) ;
void PostReflowCallback();
void InitGroup(nsCSSFrameConstructor* aFC, nsIPresContext* aContext)

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

@ -789,10 +789,8 @@ nsSliderFrame::CurrentPositionChanged(nsIPresContext* aPresContext)
nsRect changeRect;
changeRect.UnionRect(thumbRect, newThumbRect);
if (!changeRect.IsEmpty()) {
// redraw just the change
Invalidate(aPresContext, changeRect, mRedrawImmediate);
}
Invalidate(changeRect, mRedrawImmediate);
if (mScrollbarListener)
mScrollbarListener->PositionChanged(aPresContext, mCurPos, curpos);

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

@ -890,9 +890,7 @@ NS_IMETHODIMP nsTreeBodyFrame::Invalidate()
{
if (mUpdateBatchNest)
return NS_OK;
if (!mRect.IsEmpty()) {
nsLeafBoxFrame::Invalidate(mPresContext, mRect, PR_FALSE);
}
nsIFrame::Invalidate(GetOutlineRect(), PR_FALSE);
return NS_OK;
}
@ -905,7 +903,7 @@ NS_IMETHODIMP nsTreeBodyFrame::InvalidateColumn(const PRUnichar *aColID)
currCol = currCol->GetNext()) {
if (currCol->GetID().Equals(aColID)) {
nsRect columnRect(currX, mInnerBox.y, currCol->GetWidth(), mInnerBox.height);
nsLeafBoxFrame::Invalidate(mPresContext, columnRect, PR_FALSE);
nsIFrame::Invalidate(columnRect, PR_FALSE);
break;
}
currX += currCol->GetWidth();
@ -922,8 +920,7 @@ NS_IMETHODIMP nsTreeBodyFrame::InvalidateRow(PRInt32 aIndex)
return NS_OK;
nsRect rowRect(mInnerBox.x, mInnerBox.y+mRowHeight*(aIndex-mTopRowIndex), mInnerBox.width, mRowHeight);
if (!rowRect.IsEmpty())
nsLeafBoxFrame::Invalidate(mPresContext, rowRect, PR_FALSE);
nsIFrame::Invalidate(rowRect, PR_FALSE);
return NS_OK;
}
@ -944,7 +941,7 @@ NS_IMETHODIMP nsTreeBodyFrame::InvalidateCell(PRInt32 aIndex, const PRUnichar *a
if (currCol->GetID().Equals(aColID)) {
nsRect cellRect(currX, yPos, currCol->GetWidth(), mRowHeight);
nsLeafBoxFrame::Invalidate(mPresContext, cellRect, PR_FALSE);
nsIFrame::Invalidate(cellRect, PR_FALSE);
break;
}
currX += currCol->GetWidth();
@ -969,9 +966,9 @@ NS_IMETHODIMP nsTreeBodyFrame::InvalidatePrimaryCell(PRInt32 aIndex)
#if defined(XP_MAC) || defined(XP_MACOSX)
// Mac can't process the event loop during a drag, so if we're dragging,
// invalidate synchronously.
nsLeafBoxFrame::Invalidate(mPresContext, cellRect, mDragSession ? PR_TRUE : PR_FALSE);
nsIFrame::Invalidate(cellRect, mDragSession != null);
#else
nsLeafBoxFrame::Invalidate(mPresContext, cellRect, PR_FALSE);
nsIFrame::Invalidate(cellRect, PR_FALSE);
#endif
break;
}
@ -999,7 +996,7 @@ NS_IMETHODIMP nsTreeBodyFrame::InvalidateRange(PRInt32 aStart, PRInt32 aEnd)
aEnd = last;
nsRect rangeRect(mInnerBox.x, mInnerBox.y+mRowHeight*(aStart-mTopRowIndex), mInnerBox.width, mRowHeight*(aEnd-aStart+1));
nsLeafBoxFrame::Invalidate(mPresContext, rangeRect, PR_FALSE);
nsIFrame::Invalidate(rangeRect, PR_FALSE);
return NS_OK;
}