From bf9fa1fa2f71bbd06e2002a85b2250a543cea742 Mon Sep 17 00:00:00 2001 From: "bryner%netscape.com" Date: Sat, 18 Aug 2001 07:25:52 +0000 Subject: [PATCH] Bug 66617 - if tabbing scrolls page, focus outline doesn't leave first link (second try). r=saari, sr=hyatt. git-svn-id: svn://10.0.0.236/trunk@101405 18797224-902f-48f8-a5cc-f745e15eee43 --- .../content/html/content/src/nsHTMLAnchorElement.cpp | 11 ----------- mozilla/layout/base/public/nsIFrame.h | 11 ----------- mozilla/layout/generic/nsFrame.cpp | 5 ++--- mozilla/layout/generic/nsFrame.h | 6 +++--- mozilla/layout/generic/nsIFrame.h | 11 ----------- mozilla/layout/html/base/src/nsFrame.cpp | 5 ++--- mozilla/layout/html/base/src/nsFrame.h | 6 +++--- mozilla/view/src/nsScrollPortView.cpp | 8 +++++++- mozilla/view/src/nsScrollingView.cpp | 7 +++++++ 9 files changed, 24 insertions(+), 46 deletions(-) diff --git a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp index 7651890345e..d0d09b7836f 100644 --- a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp @@ -311,9 +311,6 @@ nsHTMLAnchorElement::SetFocus(nsIPresContext* aPresContext) aPresContext->GetEventStateManager(getter_AddRefs(stateManager)); if (stateManager) { - nsCOMPtr oldFocus; - stateManager->GetFocusedContent(getter_AddRefs(oldFocus)); - stateManager->SetContentState(this, NS_EVENT_STATE_FOCUS); // Make sure the presentation is up-to-date @@ -330,14 +327,6 @@ nsHTMLAnchorElement::SetFocus(nsIPresContext* aPresContext) if (frame) { presShell->ScrollFrameIntoView(frame, NS_PRESSHELL_SCROLL_ANYWHERE, NS_PRESSHELL_SCROLL_ANYWHERE); - nsIFrame* oldFocusFrame = nsnull; - presShell->GetPrimaryFrameFor(oldFocus, &oldFocusFrame); - if (oldFocusFrame) { - // Invalidate the area that the old frame covers - nsRect rect; - oldFocusFrame->GetRect(rect); - oldFocusFrame->Invalidate(aPresContext, rect, PR_FALSE); - } } } } diff --git a/mozilla/layout/base/public/nsIFrame.h b/mozilla/layout/base/public/nsIFrame.h index 8e1fb9364a9..c1b2914823d 100644 --- a/mozilla/layout/base/public/nsIFrame.h +++ b/mozilla/layout/base/public/nsIFrame.h @@ -1031,17 +1031,6 @@ public: nsIRenderingContext& aRenderingContext, PRBool aCheckVis, PRBool* aIsVisible) = 0; - - /** - * Invalidate part of the frame by asking the view manager to repaint. - * @param aPresContext a PresContext for this frame - * @param aDamageRect area of the frame to repaint, in the frame's local coordinate space - * @param aImmedaite repaint synchronously - */ - NS_IMETHOD Invalidate(nsIPresContext* aPresContext, - const nsRect& aDamageRect, - PRBool aImmediate = PR_FALSE) const = 0; - #ifdef IBMBIDI /** * retrieve and set Bidi property of this frame diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index 316346ea06d..de12a4eaeb4 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -2177,7 +2177,7 @@ nsFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } -NS_IMETHODIMP +void nsFrame::Invalidate(nsIPresContext* aPresContext, const nsRect& aDamageRect, PRBool aImmediate) const @@ -2191,7 +2191,7 @@ nsFrame::Invalidate(nsIPresContext* aPresContext, PRBool suppressed = PR_FALSE; shell->IsPaintingSuppressed(&suppressed); if (suppressed) - return NS_OK; + return; } } @@ -2228,7 +2228,6 @@ nsFrame::Invalidate(nsIPresContext* aPresContext, } NS_IF_RELEASE(viewManager); - return NS_OK; } //#define MAX_REFLOW_DEPTH 500 get this from nsIHTMLContentSink.h; bug 55095 diff --git a/mozilla/layout/generic/nsFrame.h b/mozilla/layout/generic/nsFrame.h index c9f61422205..ae5ad9c6344 100644 --- a/mozilla/layout/generic/nsFrame.h +++ b/mozilla/layout/generic/nsFrame.h @@ -347,9 +347,9 @@ public: // Invalidate part of the frame by asking the view manager to repaint. // aDamageRect is in the frame's local coordinate space - NS_IMETHOD Invalidate(nsIPresContext* aPresContext, - const nsRect& aDamageRect, - PRBool aImmediate = PR_FALSE) const; + void Invalidate(nsIPresContext* aPresContext, + const nsRect& aDamageRect, + PRBool aImmediate = PR_FALSE) const; // Helper function to return the index in parent of the frame's content // object. Returns -1 on error or if the frame doesn't have a content object diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h index 8e1fb9364a9..c1b2914823d 100644 --- a/mozilla/layout/generic/nsIFrame.h +++ b/mozilla/layout/generic/nsIFrame.h @@ -1031,17 +1031,6 @@ public: nsIRenderingContext& aRenderingContext, PRBool aCheckVis, PRBool* aIsVisible) = 0; - - /** - * Invalidate part of the frame by asking the view manager to repaint. - * @param aPresContext a PresContext for this frame - * @param aDamageRect area of the frame to repaint, in the frame's local coordinate space - * @param aImmedaite repaint synchronously - */ - NS_IMETHOD Invalidate(nsIPresContext* aPresContext, - const nsRect& aDamageRect, - PRBool aImmediate = PR_FALSE) const = 0; - #ifdef IBMBIDI /** * retrieve and set Bidi property of this frame diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index 316346ea06d..de12a4eaeb4 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -2177,7 +2177,7 @@ nsFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } -NS_IMETHODIMP +void nsFrame::Invalidate(nsIPresContext* aPresContext, const nsRect& aDamageRect, PRBool aImmediate) const @@ -2191,7 +2191,7 @@ nsFrame::Invalidate(nsIPresContext* aPresContext, PRBool suppressed = PR_FALSE; shell->IsPaintingSuppressed(&suppressed); if (suppressed) - return NS_OK; + return; } } @@ -2228,7 +2228,6 @@ nsFrame::Invalidate(nsIPresContext* aPresContext, } NS_IF_RELEASE(viewManager); - return NS_OK; } //#define MAX_REFLOW_DEPTH 500 get this from nsIHTMLContentSink.h; bug 55095 diff --git a/mozilla/layout/html/base/src/nsFrame.h b/mozilla/layout/html/base/src/nsFrame.h index c9f61422205..ae5ad9c6344 100644 --- a/mozilla/layout/html/base/src/nsFrame.h +++ b/mozilla/layout/html/base/src/nsFrame.h @@ -347,9 +347,9 @@ public: // Invalidate part of the frame by asking the view manager to repaint. // aDamageRect is in the frame's local coordinate space - NS_IMETHOD Invalidate(nsIPresContext* aPresContext, - const nsRect& aDamageRect, - PRBool aImmediate = PR_FALSE) const; + void Invalidate(nsIPresContext* aPresContext, + const nsRect& aDamageRect, + PRBool aImmediate = PR_FALSE) const; // Helper function to return the index in parent of the frame's content // object. Returns -1 on error or if the frame doesn't have a content object diff --git a/mozilla/view/src/nsScrollPortView.cpp b/mozilla/view/src/nsScrollPortView.cpp index 791c4f48e4b..bfef3b217cd 100644 --- a/mozilla/view/src/nsScrollPortView.cpp +++ b/mozilla/view/src/nsScrollPortView.cpp @@ -36,6 +36,7 @@ #include "nsIClipView.h" #include "nsISupportsArray.h" #include "nsIScrollPositionListener.h" +#include "nsIRegion.h" static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID); static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); @@ -527,7 +528,12 @@ void nsScrollPortView::Scroll(nsIView *aScrolledView, PRInt32 aDx, PRInt32 aDy, { if ((aDx != 0) || (aDy != 0)) { - + // Since we keep track of the dirty region as absolute screen coordintes, + // we need to offset it by the amount we scrolled. + nsCOMPtr dirtyRegion; + GetDirtyRegion(*getter_AddRefs(dirtyRegion)); + dirtyRegion->Offset(aDx, aDy); + nsIWidget *scrollWidget = nsnull; GetWidget(scrollWidget); diff --git a/mozilla/view/src/nsScrollingView.cpp b/mozilla/view/src/nsScrollingView.cpp index 9821508d903..64c6e85959f 100644 --- a/mozilla/view/src/nsScrollingView.cpp +++ b/mozilla/view/src/nsScrollingView.cpp @@ -36,6 +36,7 @@ #include "nsIClipView.h" #include "nsISupportsArray.h" #include "nsIScrollPositionListener.h" +#include "nsIRegion.h" static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID); static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); @@ -1676,6 +1677,12 @@ void nsScrollingView::Scroll(nsIView *aScrolledView, PRInt32 aDx, PRInt32 aDy, f { if ((aDx != 0) || (aDy != 0)) { + // Since we keep track of the dirty region as absolute screen coordintes, + // we need to offset it by the amount we scrolled. + nsCOMPtr dirtyRegion; + GetDirtyRegion(*getter_AddRefs(dirtyRegion)); + dirtyRegion->Offset(aDx, aDy); + nsIWidget *clipWidget; mClipView->GetWidget(clipWidget);