From d82b9d3db0a92ef3252f1f37f51864ce1bb583f5 Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Thu, 26 Aug 2004 00:07:56 +0000 Subject: [PATCH] Bug 133165. Draw the outline outside the frame's normal overflow area. r+sr=dbaron. Also, correct some trivial misuses of nsChangeHint, r+sr=mozbot git-svn-id: svn://10.0.0.236/trunk@161292 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsCSSFrameConstructor.cpp | 8 +- mozilla/layout/base/nsCSSRendering.cpp | 13 +-- mozilla/layout/base/public/nsIFrame.h | 9 ++- .../forms/nsGfxCheckboxControlFrame.cpp | 2 +- .../layout/forms/nsGfxRadioControlFrame.cpp | 2 +- mozilla/layout/generic/nsContainerFrame.cpp | 6 ++ mozilla/layout/generic/nsFrame.cpp | 81 ++++++++----------- mozilla/layout/generic/nsHTMLFrame.cpp | 4 +- mozilla/layout/generic/nsIFrame.h | 9 ++- .../layout/html/base/src/nsContainerFrame.cpp | 6 ++ mozilla/layout/html/base/src/nsFrame.cpp | 81 ++++++++----------- mozilla/layout/html/base/src/nsHTMLFrame.cpp | 4 +- mozilla/layout/html/document/src/html.css | 12 --- .../forms/src/nsGfxCheckboxControlFrame.cpp | 2 +- .../html/forms/src/nsGfxRadioControlFrame.cpp | 2 +- .../html/style/src/nsCSSFrameConstructor.cpp | 8 +- .../layout/html/style/src/nsCSSRendering.cpp | 13 +-- .../html/table/src/nsTableCellFrame.cpp | 4 +- mozilla/layout/style/html.css | 12 --- mozilla/layout/tables/nsTableCellFrame.cpp | 4 +- mozilla/layout/xul/base/src/nsBox.cpp | 2 +- .../xul/base/src/tree/src/nsTreeBodyFrame.cpp | 2 +- 22 files changed, 130 insertions(+), 156 deletions(-) diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index cc785daf73b..77bfdf60990 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -9780,7 +9780,7 @@ UpdateViewsForTree(nsPresContext* aPresContext, nsIFrame* aFrame, } } - nsRect bounds = aFrame->GetOutlineRect(); + nsRect bounds = aFrame->GetOverflowRect(); // now do children of frame PRInt32 listIndex = 0; @@ -10103,7 +10103,7 @@ nsCSSFrameConstructor::RestyleElement(nsPresContext *aPresContext, RecreateFramesForContent(aPresContext, aContent); } else if (aPrimaryFrame) { nsStyleChangeList changeList; - if (aMinHint != NS_STYLE_HINT_NONE) { + if (aMinHint) { changeList.AppendChange(aPrimaryFrame, aContent, aMinHint); } nsChangeHint frameChange = aPresContext->GetPresShell()->FrameManager()-> @@ -13525,7 +13525,7 @@ ProcessRestyle(nsISupports* aContent, if (aData.mRestyleHint & eReStyle_Self) { shell->FrameConstructor()->RestyleElement(context, content, primaryFrame, aData.mChangeHint); - } else if (aData.mChangeHint != NS_STYLE_HINT_NONE && + } else if (aData.mChangeHint && (primaryFrame || (aData.mChangeHint & nsChangeHint_ReconstructFrame))) { // Don't need to recompute style; just apply the hint @@ -13557,7 +13557,7 @@ nsCSSFrameConstructor::PostRestyleEvent(nsIContent* aContent, nsReStyleHint aRestyleHint, nsChangeHint aMinChangeHint) { - if (aRestyleHint == 0 && aMinChangeHint == NS_STYLE_HINT_NONE) { + if (aRestyleHint == 0 && !aMinChangeHint) { // Nothing to do here return; } diff --git a/mozilla/layout/base/nsCSSRendering.cpp b/mozilla/layout/base/nsCSSRendering.cpp index 774776473a7..7f1bf4393d3 100644 --- a/mozilla/layout/base/nsCSSRendering.cpp +++ b/mozilla/layout/base/nsCSSRendering.cpp @@ -2087,12 +2087,15 @@ nscoord width; } } - nsRect inside(aBorderArea); - nsRect outside(inside); - outside.Inflate(width, width); + nsRect* overflowArea = aForFrame->GetOverflowAreaProperty(PR_FALSE); + if (!overflowArea) { + NS_WARNING("Hmm, outline painting should always find an overflow area here"); + return; + } - nsRect clipRect(aBorderArea); - clipRect.Inflate(width, width); // make clip extra big for now + nsRect outside(*overflowArea); + nsRect inside(outside); + inside.Deflate(width, width); // rounded version of the border for(i=0;i<4;i++){ diff --git a/mozilla/layout/base/public/nsIFrame.h b/mozilla/layout/base/public/nsIFrame.h index 071002b162c..b8268bc076e 100644 --- a/mozilla/layout/base/public/nsIFrame.h +++ b/mozilla/layout/base/public/nsIFrame.h @@ -1033,13 +1033,14 @@ public: void Invalidate(const nsRect& aDamageRect, PRBool aImmediate = PR_FALSE) const; /** - * Computes a rect that includes this frame's outline. The returned rect is - * relative to this frame's origin. + * Computes a rect that includes this frame, all its descendant + * frames, this frame's outline (if any), and all descendant frames' + * outlines (if any). This is the union of everything that might be painted by + * this frame subtree. * - * @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, nsSize *aUseSize = nsnull) const; + nsRect GetOverflowRect() const; /** * Set/unset the NS_FRAME_OUTSIDE_CHILDREN flag and store the overflow area diff --git a/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp b/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp index 01a28e203b4..b561084bd20 100644 --- a/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp @@ -167,7 +167,7 @@ NS_IMETHODIMP nsGfxCheckboxControlFrame::OnChecked(nsPresContext* aPresContext, PRBool aChecked) { - Invalidate(GetOutlineRect(), PR_FALSE); + Invalidate(GetOverflowRect(), PR_FALSE); return aChecked; } diff --git a/mozilla/layout/forms/nsGfxRadioControlFrame.cpp b/mozilla/layout/forms/nsGfxRadioControlFrame.cpp index 7d60de462a9..70cae44e446 100644 --- a/mozilla/layout/forms/nsGfxRadioControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxRadioControlFrame.cpp @@ -238,7 +238,7 @@ NS_IMETHODIMP nsGfxRadioControlFrame::OnChecked(nsPresContext* aPresContext, PRBool aChecked) { - Invalidate(GetOutlineRect(), PR_FALSE); + Invalidate(GetOverflowRect(), PR_FALSE); return NS_OK; } diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index c05c64d5595..8f1005a5549 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -1320,6 +1320,12 @@ nsContainerFrame::List(nsPresContext* aPresContext, FILE* out, PRInt32 aIndent) fprintf(out, " [state=%08x]", mState); } fprintf(out, " [content=%p]", NS_STATIC_CAST(void*, mContent)); + nsContainerFrame* f = NS_CONST_CAST(nsContainerFrame*, this); + nsRect* overflowArea = f->GetOverflowAreaProperty(PR_FALSE); + if (overflowArea) { + fprintf(out, " [overflow=%d,%d,%d,%d]", overflowArea->x, overflowArea->y, + overflowArea->width, overflowArea->height); + } fprintf(out, " [sc=%p]", NS_STATIC_CAST(void*, mStyleContext)); // Output the children diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index 4b07ce162c9..aac1f82dec9 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -766,23 +766,6 @@ nsFrame::SetOverflowClipRect(nsIRenderingContext& aRenderingContext) aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect); } -/******************************************************** -* Refreshes this frame and all child frames that are frames for aContent -*********************************************************/ -static void RefreshAllContentFrames(nsIFrame* aFrame, nsIContent* aContent) -{ - if (aFrame->GetContent() == aContent) { - // XXX is this necessary? - aFrame->Invalidate(aFrame->GetOutlineRect(), PR_FALSE); - } - - aFrame = aFrame->GetFirstChild(nsnull); - while (aFrame) { - RefreshAllContentFrames(aFrame, aContent); - aFrame = aFrame->GetNextSibling(); - } -} - /******************************************************** * Refreshes each content's frame *********************************************************/ @@ -1704,9 +1687,6 @@ static nsIView* GetNearestCapturingView(nsIFrame* aFrame) { return nsnull; } -#ifdef DEBUG_roc - printf("*** Setting capture to frame %p, view %p\n", (void*)aFrame, (void*)view); -#endif return view; } @@ -2503,17 +2483,12 @@ nsIFrame::Invalidate(const nsRect& aDamageRect, } } -nsRect -nsIFrame::GetOutlineRect(PRBool* aAnyOutline, nsSize *aUseSize) const -{ - const nsStyleOutline* outline = GetStyleOutline(); +static nsRect ComputeOutlineRect(const nsIFrame* aFrame, PRBool* aAnyOutline, + const nsRect& aOverflowRect) { + const nsStyleOutline* outline = aFrame->GetStyleOutline(); PRUint8 outlineStyle = outline->GetOutlineStyle(); - nsRect r(0, 0, mRect.width, mRect.height); - if (aUseSize) { - r.width = aUseSize->width; - r.height = aUseSize->height; - } - PRBool anyOutline = PR_FALSE; + nsRect r = aOverflowRect; + *aAnyOutline = PR_FALSE; if (outlineStyle != NS_STYLE_BORDER_STYLE_NONE) { nscoord width; #ifdef DEBUG @@ -2523,15 +2498,29 @@ nsIFrame::GetOutlineRect(PRBool* aAnyOutline, nsSize *aUseSize) const NS_ASSERTION(result, "GetOutlineWidth had no cached outline width"); if (width > 0) { r.Inflate(width, width); - anyOutline = PR_TRUE; + *aAnyOutline = PR_TRUE; } } - if (aAnyOutline) { - *aAnyOutline = anyOutline; - } return r; } +nsRect +nsIFrame::GetOverflowRect() const +{ + // Note that in some cases the overflow area might not have been + // updated (yet) to reflect any outline set on the frame or the area + // of child frames. That's OK because any reflow that updates these + // areas will invalidate the appropriate area, so any (mis)uses of + // this method will be fixed up. + nsRect* storedOA = NS_CONST_CAST(nsIFrame*, this) + ->GetOverflowAreaProperty(PR_FALSE); + if (storedOA) { + return *storedOA; + } else { + return nsRect(nsPoint(0, 0), GetSize()); + } +} + void nsFrame::CheckInvalidateSizeChange(nsPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -2553,7 +2542,8 @@ nsFrame::CheckInvalidateSizeChange(nsPresContext* aPresContext, // Invalidate the entire old frame+outline if the frame has an outline PRBool anyOutline; - nsRect r = GetOutlineRect(&anyOutline); + nsRect r = ComputeOutlineRect(this, &anyOutline, + aDesiredSize.mOverflowArea); if (anyOutline) { Invalidate(r); return; @@ -2683,6 +2673,12 @@ nsFrame::List(nsPresContext* aPresContext, FILE* out, PRInt32 aIndent) const fprintf(out, " [state=%08x]", mState); } fprintf(out, " [content=%p]", NS_STATIC_CAST(void*, mContent)); + nsFrame* f = NS_CONST_CAST(nsFrame*, this); + nsRect* overflowArea = f->GetOverflowAreaProperty(PR_FALSE); + if (overflowArea) { + fprintf(out, " [overflow=%d,%d,%d,%d]", overflowArea->x, overflowArea->y, + overflowArea->width, overflowArea->height); + } fputs("\n", out); return NS_OK; } @@ -3019,14 +3015,8 @@ nsFrame::SetSelected(nsPresContext* aPresContext, nsIDOMRange *aRange, PRBool aS else RemoveStateBits(NS_FRAME_SELECTED_CONTENT); - // 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(this, mContent); - } + // Repaint this frame subtree's entire area + Invalidate(GetOverflowRect(), PR_FALSE); #ifdef IBMBIDI PRInt32 start, end; @@ -4250,7 +4240,7 @@ nsIFrame::FinishAndStoreOverflow(nsRect* aOverflowArea, nsSize aNewSize) // we should think about starting a new method like GetAdditionalOverflow() PRBool hasOutline; - nsRect outlineRect(GetOutlineRect(&hasOutline, &aNewSize)); + nsRect outlineRect(ComputeOutlineRect(this, &hasOutline, *aOverflowArea)); if (hasOutline || (aOverflowArea->x < 0) || @@ -4260,8 +4250,7 @@ nsIFrame::FinishAndStoreOverflow(nsRect* aOverflowArea, nsSize aNewSize) mState |= NS_FRAME_OUTSIDE_CHILDREN; nsRect* overflowArea = GetOverflowAreaProperty(PR_TRUE); NS_ASSERTION(overflowArea, "should have created rect"); - aOverflowArea->UnionRect(outlineRect, *aOverflowArea); - *overflowArea = *aOverflowArea; + *aOverflowArea = *overflowArea = outlineRect; } else { if (mState & NS_FRAME_OUTSIDE_CHILDREN) { diff --git a/mozilla/layout/generic/nsHTMLFrame.cpp b/mozilla/layout/generic/nsHTMLFrame.cpp index 5e6a4ffac4b..8a88e8aa89c 100644 --- a/mozilla/layout/generic/nsHTMLFrame.cpp +++ b/mozilla/layout/generic/nsHTMLFrame.cpp @@ -348,7 +348,7 @@ CanvasFrame::RemoveFrame(nsPresContext* aPresContext, // 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->GetOutlineRect() + aOldFrame->GetPosition(), PR_FALSE); + Invalidate(aOldFrame->GetOverflowRect() + aOldFrame->GetPosition(), PR_FALSE); // Remove the frame and destroy it mFrames.DestroyFrame(aPresContext, aOldFrame); @@ -566,7 +566,7 @@ CanvasFrame::Reflow(nsPresContext* aPresContext, // If the child frame was just inserted, then we're responsible for making sure // it repaints if (isDirtyChildReflow) { - Invalidate(kidFrame->GetOutlineRect() + kidFrame->GetPosition(), PR_FALSE); + Invalidate(kidFrame->GetOverflowRect() + kidFrame->GetPosition(), PR_FALSE); } // Return our desired size diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h index 071002b162c..b8268bc076e 100644 --- a/mozilla/layout/generic/nsIFrame.h +++ b/mozilla/layout/generic/nsIFrame.h @@ -1033,13 +1033,14 @@ public: void Invalidate(const nsRect& aDamageRect, PRBool aImmediate = PR_FALSE) const; /** - * Computes a rect that includes this frame's outline. The returned rect is - * relative to this frame's origin. + * Computes a rect that includes this frame, all its descendant + * frames, this frame's outline (if any), and all descendant frames' + * outlines (if any). This is the union of everything that might be painted by + * this frame subtree. * - * @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, nsSize *aUseSize = nsnull) const; + nsRect GetOverflowRect() const; /** * Set/unset the NS_FRAME_OUTSIDE_CHILDREN flag and store the overflow area diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp index c05c64d5595..8f1005a5549 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsContainerFrame.cpp @@ -1320,6 +1320,12 @@ nsContainerFrame::List(nsPresContext* aPresContext, FILE* out, PRInt32 aIndent) fprintf(out, " [state=%08x]", mState); } fprintf(out, " [content=%p]", NS_STATIC_CAST(void*, mContent)); + nsContainerFrame* f = NS_CONST_CAST(nsContainerFrame*, this); + nsRect* overflowArea = f->GetOverflowAreaProperty(PR_FALSE); + if (overflowArea) { + fprintf(out, " [overflow=%d,%d,%d,%d]", overflowArea->x, overflowArea->y, + overflowArea->width, overflowArea->height); + } fprintf(out, " [sc=%p]", NS_STATIC_CAST(void*, mStyleContext)); // Output the children diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index 4b07ce162c9..aac1f82dec9 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -766,23 +766,6 @@ nsFrame::SetOverflowClipRect(nsIRenderingContext& aRenderingContext) aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect); } -/******************************************************** -* Refreshes this frame and all child frames that are frames for aContent -*********************************************************/ -static void RefreshAllContentFrames(nsIFrame* aFrame, nsIContent* aContent) -{ - if (aFrame->GetContent() == aContent) { - // XXX is this necessary? - aFrame->Invalidate(aFrame->GetOutlineRect(), PR_FALSE); - } - - aFrame = aFrame->GetFirstChild(nsnull); - while (aFrame) { - RefreshAllContentFrames(aFrame, aContent); - aFrame = aFrame->GetNextSibling(); - } -} - /******************************************************** * Refreshes each content's frame *********************************************************/ @@ -1704,9 +1687,6 @@ static nsIView* GetNearestCapturingView(nsIFrame* aFrame) { return nsnull; } -#ifdef DEBUG_roc - printf("*** Setting capture to frame %p, view %p\n", (void*)aFrame, (void*)view); -#endif return view; } @@ -2503,17 +2483,12 @@ nsIFrame::Invalidate(const nsRect& aDamageRect, } } -nsRect -nsIFrame::GetOutlineRect(PRBool* aAnyOutline, nsSize *aUseSize) const -{ - const nsStyleOutline* outline = GetStyleOutline(); +static nsRect ComputeOutlineRect(const nsIFrame* aFrame, PRBool* aAnyOutline, + const nsRect& aOverflowRect) { + const nsStyleOutline* outline = aFrame->GetStyleOutline(); PRUint8 outlineStyle = outline->GetOutlineStyle(); - nsRect r(0, 0, mRect.width, mRect.height); - if (aUseSize) { - r.width = aUseSize->width; - r.height = aUseSize->height; - } - PRBool anyOutline = PR_FALSE; + nsRect r = aOverflowRect; + *aAnyOutline = PR_FALSE; if (outlineStyle != NS_STYLE_BORDER_STYLE_NONE) { nscoord width; #ifdef DEBUG @@ -2523,15 +2498,29 @@ nsIFrame::GetOutlineRect(PRBool* aAnyOutline, nsSize *aUseSize) const NS_ASSERTION(result, "GetOutlineWidth had no cached outline width"); if (width > 0) { r.Inflate(width, width); - anyOutline = PR_TRUE; + *aAnyOutline = PR_TRUE; } } - if (aAnyOutline) { - *aAnyOutline = anyOutline; - } return r; } +nsRect +nsIFrame::GetOverflowRect() const +{ + // Note that in some cases the overflow area might not have been + // updated (yet) to reflect any outline set on the frame or the area + // of child frames. That's OK because any reflow that updates these + // areas will invalidate the appropriate area, so any (mis)uses of + // this method will be fixed up. + nsRect* storedOA = NS_CONST_CAST(nsIFrame*, this) + ->GetOverflowAreaProperty(PR_FALSE); + if (storedOA) { + return *storedOA; + } else { + return nsRect(nsPoint(0, 0), GetSize()); + } +} + void nsFrame::CheckInvalidateSizeChange(nsPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -2553,7 +2542,8 @@ nsFrame::CheckInvalidateSizeChange(nsPresContext* aPresContext, // Invalidate the entire old frame+outline if the frame has an outline PRBool anyOutline; - nsRect r = GetOutlineRect(&anyOutline); + nsRect r = ComputeOutlineRect(this, &anyOutline, + aDesiredSize.mOverflowArea); if (anyOutline) { Invalidate(r); return; @@ -2683,6 +2673,12 @@ nsFrame::List(nsPresContext* aPresContext, FILE* out, PRInt32 aIndent) const fprintf(out, " [state=%08x]", mState); } fprintf(out, " [content=%p]", NS_STATIC_CAST(void*, mContent)); + nsFrame* f = NS_CONST_CAST(nsFrame*, this); + nsRect* overflowArea = f->GetOverflowAreaProperty(PR_FALSE); + if (overflowArea) { + fprintf(out, " [overflow=%d,%d,%d,%d]", overflowArea->x, overflowArea->y, + overflowArea->width, overflowArea->height); + } fputs("\n", out); return NS_OK; } @@ -3019,14 +3015,8 @@ nsFrame::SetSelected(nsPresContext* aPresContext, nsIDOMRange *aRange, PRBool aS else RemoveStateBits(NS_FRAME_SELECTED_CONTENT); - // 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(this, mContent); - } + // Repaint this frame subtree's entire area + Invalidate(GetOverflowRect(), PR_FALSE); #ifdef IBMBIDI PRInt32 start, end; @@ -4250,7 +4240,7 @@ nsIFrame::FinishAndStoreOverflow(nsRect* aOverflowArea, nsSize aNewSize) // we should think about starting a new method like GetAdditionalOverflow() PRBool hasOutline; - nsRect outlineRect(GetOutlineRect(&hasOutline, &aNewSize)); + nsRect outlineRect(ComputeOutlineRect(this, &hasOutline, *aOverflowArea)); if (hasOutline || (aOverflowArea->x < 0) || @@ -4260,8 +4250,7 @@ nsIFrame::FinishAndStoreOverflow(nsRect* aOverflowArea, nsSize aNewSize) mState |= NS_FRAME_OUTSIDE_CHILDREN; nsRect* overflowArea = GetOverflowAreaProperty(PR_TRUE); NS_ASSERTION(overflowArea, "should have created rect"); - aOverflowArea->UnionRect(outlineRect, *aOverflowArea); - *overflowArea = *aOverflowArea; + *aOverflowArea = *overflowArea = outlineRect; } else { if (mState & NS_FRAME_OUTSIDE_CHILDREN) { diff --git a/mozilla/layout/html/base/src/nsHTMLFrame.cpp b/mozilla/layout/html/base/src/nsHTMLFrame.cpp index 5e6a4ffac4b..8a88e8aa89c 100644 --- a/mozilla/layout/html/base/src/nsHTMLFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLFrame.cpp @@ -348,7 +348,7 @@ CanvasFrame::RemoveFrame(nsPresContext* aPresContext, // 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->GetOutlineRect() + aOldFrame->GetPosition(), PR_FALSE); + Invalidate(aOldFrame->GetOverflowRect() + aOldFrame->GetPosition(), PR_FALSE); // Remove the frame and destroy it mFrames.DestroyFrame(aPresContext, aOldFrame); @@ -566,7 +566,7 @@ CanvasFrame::Reflow(nsPresContext* aPresContext, // If the child frame was just inserted, then we're responsible for making sure // it repaints if (isDirtyChildReflow) { - Invalidate(kidFrame->GetOutlineRect() + kidFrame->GetPosition(), PR_FALSE); + Invalidate(kidFrame->GetOverflowRect() + kidFrame->GetPosition(), PR_FALSE); } // Return our desired size diff --git a/mozilla/layout/html/document/src/html.css b/mozilla/layout/html/document/src/html.css index 4b15ab3836e..e113c0cfcf1 100644 --- a/mozilla/layout/html/document/src/html.css +++ b/mozilla/layout/html/document/src/html.css @@ -408,18 +408,6 @@ noframes { display: none; } -*|*:-moz-any-link:focus img { - -moz-outline: 1px dotted invert; -} - -*|*:-moz-any-link:focus object { - -moz-outline: 1px dotted invert; -} - -*|*:-moz-any-link:focus embed { - -moz-outline: 1px dotted invert; -} - /* focusable content: anything w/ tabindex >=0 is focusable */ abbr:focus, acronym:focus, address:focus, applet:focus, b:focus, base:focus, big:focus, blockquote:focus, br:focus, caption:focus, center:focus, diff --git a/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp index 01a28e203b4..b561084bd20 100644 --- a/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp @@ -167,7 +167,7 @@ NS_IMETHODIMP nsGfxCheckboxControlFrame::OnChecked(nsPresContext* aPresContext, PRBool aChecked) { - Invalidate(GetOutlineRect(), PR_FALSE); + Invalidate(GetOverflowRect(), PR_FALSE); return aChecked; } diff --git a/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp index 7d60de462a9..70cae44e446 100644 --- a/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp @@ -238,7 +238,7 @@ NS_IMETHODIMP nsGfxRadioControlFrame::OnChecked(nsPresContext* aPresContext, PRBool aChecked) { - Invalidate(GetOutlineRect(), PR_FALSE); + Invalidate(GetOverflowRect(), PR_FALSE); return NS_OK; } diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index cc785daf73b..77bfdf60990 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -9780,7 +9780,7 @@ UpdateViewsForTree(nsPresContext* aPresContext, nsIFrame* aFrame, } } - nsRect bounds = aFrame->GetOutlineRect(); + nsRect bounds = aFrame->GetOverflowRect(); // now do children of frame PRInt32 listIndex = 0; @@ -10103,7 +10103,7 @@ nsCSSFrameConstructor::RestyleElement(nsPresContext *aPresContext, RecreateFramesForContent(aPresContext, aContent); } else if (aPrimaryFrame) { nsStyleChangeList changeList; - if (aMinHint != NS_STYLE_HINT_NONE) { + if (aMinHint) { changeList.AppendChange(aPrimaryFrame, aContent, aMinHint); } nsChangeHint frameChange = aPresContext->GetPresShell()->FrameManager()-> @@ -13525,7 +13525,7 @@ ProcessRestyle(nsISupports* aContent, if (aData.mRestyleHint & eReStyle_Self) { shell->FrameConstructor()->RestyleElement(context, content, primaryFrame, aData.mChangeHint); - } else if (aData.mChangeHint != NS_STYLE_HINT_NONE && + } else if (aData.mChangeHint && (primaryFrame || (aData.mChangeHint & nsChangeHint_ReconstructFrame))) { // Don't need to recompute style; just apply the hint @@ -13557,7 +13557,7 @@ nsCSSFrameConstructor::PostRestyleEvent(nsIContent* aContent, nsReStyleHint aRestyleHint, nsChangeHint aMinChangeHint) { - if (aRestyleHint == 0 && aMinChangeHint == NS_STYLE_HINT_NONE) { + if (aRestyleHint == 0 && !aMinChangeHint) { // Nothing to do here return; } diff --git a/mozilla/layout/html/style/src/nsCSSRendering.cpp b/mozilla/layout/html/style/src/nsCSSRendering.cpp index 774776473a7..7f1bf4393d3 100644 --- a/mozilla/layout/html/style/src/nsCSSRendering.cpp +++ b/mozilla/layout/html/style/src/nsCSSRendering.cpp @@ -2087,12 +2087,15 @@ nscoord width; } } - nsRect inside(aBorderArea); - nsRect outside(inside); - outside.Inflate(width, width); + nsRect* overflowArea = aForFrame->GetOverflowAreaProperty(PR_FALSE); + if (!overflowArea) { + NS_WARNING("Hmm, outline painting should always find an overflow area here"); + return; + } - nsRect clipRect(aBorderArea); - clipRect.Inflate(width, width); // make clip extra big for now + nsRect outside(*overflowArea); + nsRect inside(outside); + inside.Deflate(width, width); // rounded version of the border for(i=0;i<4;i++){ diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp index 7f06c9be5d3..e4c52e98709 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp @@ -499,7 +499,7 @@ nsTableCellFrame::SetSelected(nsPresContext* aPresContext, result = frameSelection->GetTableCellSelection(&tableCellSelectionMode); if (NS_SUCCEEDED(result) && tableCellSelectionMode) { // Selection can affect content, border and outline - Invalidate(GetOutlineRect(), PR_FALSE); + Invalidate(GetOverflowRect(), PR_FALSE); } } return NS_OK; @@ -860,7 +860,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext, kidOrigin.x, kidOrigin.y, 0, aStatus); SetLastBlockHeight(kidSize.height); if (isStyleChanged) { - Invalidate(GetOutlineRect(), PR_FALSE); + Invalidate(GetOverflowRect(), PR_FALSE); } #if defined DEBUG_TABLE_REFLOW_TIMING diff --git a/mozilla/layout/style/html.css b/mozilla/layout/style/html.css index 4b15ab3836e..e113c0cfcf1 100644 --- a/mozilla/layout/style/html.css +++ b/mozilla/layout/style/html.css @@ -408,18 +408,6 @@ noframes { display: none; } -*|*:-moz-any-link:focus img { - -moz-outline: 1px dotted invert; -} - -*|*:-moz-any-link:focus object { - -moz-outline: 1px dotted invert; -} - -*|*:-moz-any-link:focus embed { - -moz-outline: 1px dotted invert; -} - /* focusable content: anything w/ tabindex >=0 is focusable */ abbr:focus, acronym:focus, address:focus, applet:focus, b:focus, base:focus, big:focus, blockquote:focus, br:focus, caption:focus, center:focus, diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp index 7f06c9be5d3..e4c52e98709 100644 --- a/mozilla/layout/tables/nsTableCellFrame.cpp +++ b/mozilla/layout/tables/nsTableCellFrame.cpp @@ -499,7 +499,7 @@ nsTableCellFrame::SetSelected(nsPresContext* aPresContext, result = frameSelection->GetTableCellSelection(&tableCellSelectionMode); if (NS_SUCCEEDED(result) && tableCellSelectionMode) { // Selection can affect content, border and outline - Invalidate(GetOutlineRect(), PR_FALSE); + Invalidate(GetOverflowRect(), PR_FALSE); } } return NS_OK; @@ -860,7 +860,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext, kidOrigin.x, kidOrigin.y, 0, aStatus); SetLastBlockHeight(kidSize.height); if (isStyleChanged) { - Invalidate(GetOutlineRect(), PR_FALSE); + Invalidate(GetOverflowRect(), PR_FALSE); } #if defined DEBUG_TABLE_REFLOW_TIMING diff --git a/mozilla/layout/xul/base/src/nsBox.cpp b/mozilla/layout/xul/base/src/nsBox.cpp index fd8e9950590..359ffe2c2e0 100644 --- a/mozilla/layout/xul/base/src/nsBox.cpp +++ b/mozilla/layout/xul/base/src/nsBox.cpp @@ -1119,7 +1119,7 @@ nsBox::Redraw(nsBoxLayoutState& aState, if (aDamageRect) damageRect = *aDamageRect; else - damageRect = frame->GetOutlineRect(); + damageRect = frame->GetOverflowRect(); frame->Invalidate(damageRect, aImmediate); diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index 1a31eeded80..dff5b934357 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -642,7 +642,7 @@ nsTreeBodyFrame::Invalidate() if (mUpdateBatchNest) return NS_OK; - nsIFrame::Invalidate(GetOutlineRect(), PR_FALSE); + nsIFrame::Invalidate(GetOverflowRect(), PR_FALSE); return NS_OK; }