From f972f867cad79d7050f2558952a0cd9256855056 Mon Sep 17 00:00:00 2001 From: "pollmann%netscape.com" Date: Fri, 8 Sep 2000 05:53:28 +0000 Subject: [PATCH] Bug 51124: Tabbing into text control now again scrolls it into view if offscreen, also adding additional bulletproofing per code review; r=jst@netscape.com git-svn-id: svn://10.0.0.236/trunk@78494 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/forms/nsComboboxControlFrame.cpp | 5 +++-- mozilla/layout/forms/nsFileControlFrame.cpp | 5 +++-- mozilla/layout/forms/nsFormControlFrame.cpp | 5 +++-- mozilla/layout/forms/nsHTMLButtonControlFrame.cpp | 4 +++- mozilla/layout/forms/nsImageControlFrame.cpp | 5 +++-- mozilla/layout/forms/nsIsIndexFrame.cpp | 5 +++-- mozilla/layout/forms/nsListControlFrame.cpp | 5 +++-- .../html/forms/src/nsComboboxControlFrame.cpp | 5 +++-- .../layout/html/forms/src/nsFileControlFrame.cpp | 5 +++-- .../layout/html/forms/src/nsFormControlFrame.cpp | 5 +++-- .../html/forms/src/nsGfxListControlFrame.cpp | 5 +++-- .../html/forms/src/nsGfxTextControlFrame2.cpp | 14 +++++++++++++- .../html/forms/src/nsHTMLButtonControlFrame.cpp | 4 +++- .../layout/html/forms/src/nsImageControlFrame.cpp | 5 +++-- mozilla/layout/html/forms/src/nsIsIndexFrame.cpp | 5 +++-- .../layout/html/forms/src/nsListControlFrame.cpp | 5 +++-- 16 files changed, 58 insertions(+), 29 deletions(-) diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index db75a739a71..adfe86b0a33 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -501,9 +501,10 @@ nsComboboxControlFrame::ScrollIntoView(nsIPresContext* aPresContext) if (aPresContext) { nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - - presShell->ScrollFrameIntoView(this, + if (presShell) { + presShell->ScrollFrameIntoView(this, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); + } } } diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp index 0b3d14c6112..83645ecbee0 100644 --- a/mozilla/layout/forms/nsFileControlFrame.cpp +++ b/mozilla/layout/forms/nsFileControlFrame.cpp @@ -225,9 +225,10 @@ nsFileControlFrame::ScrollIntoView(nsIPresContext* aPresContext) if (aPresContext) { nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->ScrollFrameIntoView(this, + if (presShell) { + presShell->ScrollFrameIntoView(this, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); - + } } } diff --git a/mozilla/layout/forms/nsFormControlFrame.cpp b/mozilla/layout/forms/nsFormControlFrame.cpp index 019b8d4d290..e1966a5a109 100644 --- a/mozilla/layout/forms/nsFormControlFrame.cpp +++ b/mozilla/layout/forms/nsFormControlFrame.cpp @@ -638,9 +638,10 @@ nsFormControlFrame::ScrollIntoView(nsIPresContext* aPresContext) if (aPresContext) { nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->ScrollFrameIntoView(this, + if (presShell) { + presShell->ScrollFrameIntoView(this, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); - + } } } diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp index 6c9cdf83bf4..9409a6fe08f 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp @@ -361,9 +361,11 @@ nsHTMLButtonControlFrame::ScrollIntoView(nsIPresContext* aPresContext) if (aPresContext) { nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->ScrollFrameIntoView(this, + if (presShell) { + presShell->ScrollFrameIntoView(this, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); + } } } diff --git a/mozilla/layout/forms/nsImageControlFrame.cpp b/mozilla/layout/forms/nsImageControlFrame.cpp index 5dec9265503..7632dc8823d 100644 --- a/mozilla/layout/forms/nsImageControlFrame.cpp +++ b/mozilla/layout/forms/nsImageControlFrame.cpp @@ -327,9 +327,10 @@ nsImageControlFrame::ScrollIntoView(nsIPresContext* aPresContext) if (aPresContext) { nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->ScrollFrameIntoView(this, + if (presShell) { + presShell->ScrollFrameIntoView(this, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); - + } } } diff --git a/mozilla/layout/forms/nsIsIndexFrame.cpp b/mozilla/layout/forms/nsIsIndexFrame.cpp index b89989a6c18..2ef2900831d 100644 --- a/mozilla/layout/forms/nsIsIndexFrame.cpp +++ b/mozilla/layout/forms/nsIsIndexFrame.cpp @@ -276,9 +276,10 @@ nsIsIndexFrame::ScrollIntoView(nsIPresContext* aPresContext) if (aPresContext) { nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->ScrollFrameIntoView(this, + if (presShell) { + presShell->ScrollFrameIntoView(this, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); - + } } } diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index 07ac05cd303..45d0acb322b 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -2034,9 +2034,10 @@ nsListControlFrame::ScrollIntoView(nsIPresContext* aPresContext) if (aPresContext) { nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->ScrollFrameIntoView(this, + if (presShell) { + presShell->ScrollFrameIntoView(this, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); - + } } } diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp index db75a739a71..adfe86b0a33 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -501,9 +501,10 @@ nsComboboxControlFrame::ScrollIntoView(nsIPresContext* aPresContext) if (aPresContext) { nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - - presShell->ScrollFrameIntoView(this, + if (presShell) { + presShell->ScrollFrameIntoView(this, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); + } } } diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp index 0b3d14c6112..83645ecbee0 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp @@ -225,9 +225,10 @@ nsFileControlFrame::ScrollIntoView(nsIPresContext* aPresContext) if (aPresContext) { nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->ScrollFrameIntoView(this, + if (presShell) { + presShell->ScrollFrameIntoView(this, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); - + } } } diff --git a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp index 019b8d4d290..e1966a5a109 100644 --- a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp @@ -638,9 +638,10 @@ nsFormControlFrame::ScrollIntoView(nsIPresContext* aPresContext) if (aPresContext) { nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->ScrollFrameIntoView(this, + if (presShell) { + presShell->ScrollFrameIntoView(this, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); - + } } } diff --git a/mozilla/layout/html/forms/src/nsGfxListControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxListControlFrame.cpp index df1391d5212..ef51fb3acc5 100644 --- a/mozilla/layout/html/forms/src/nsGfxListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxListControlFrame.cpp @@ -2215,9 +2215,10 @@ nsGfxListControlFrame::ScrollIntoView(nsIPresContext* aPresContext) if (aPresContext) { nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->ScrollFrameIntoView(this, + if (presShell) { + presShell->ScrollFrameIntoView(this, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); - + } } } diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp index b99ba0243d9..f160377e9a1 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp @@ -2195,7 +2195,19 @@ nsGfxTextControlFrame2::GetSizeFromContent(PRInt32* aSize) const } void nsGfxTextControlFrame2::SetFocus(PRBool aOn , PRBool aRepaint){} -void nsGfxTextControlFrame2::ScrollIntoView(nsIPresContext* aPresContext){} + +void nsGfxTextControlFrame2::ScrollIntoView(nsIPresContext* aPresContext) +{ + if (aPresContext) { + nsCOMPtr presShell; + aPresContext->GetShell(getter_AddRefs(presShell)); + if (presShell) { + presShell->ScrollFrameIntoView(this, + NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); + } + } +} + void nsGfxTextControlFrame2::MouseClicked(nsIPresContext* aPresContext){} void nsGfxTextControlFrame2::Reset(nsIPresContext* aPresContext) diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index 6c9cdf83bf4..9409a6fe08f 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -361,9 +361,11 @@ nsHTMLButtonControlFrame::ScrollIntoView(nsIPresContext* aPresContext) if (aPresContext) { nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->ScrollFrameIntoView(this, + if (presShell) { + presShell->ScrollFrameIntoView(this, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); + } } } diff --git a/mozilla/layout/html/forms/src/nsImageControlFrame.cpp b/mozilla/layout/html/forms/src/nsImageControlFrame.cpp index 5dec9265503..7632dc8823d 100644 --- a/mozilla/layout/html/forms/src/nsImageControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsImageControlFrame.cpp @@ -327,9 +327,10 @@ nsImageControlFrame::ScrollIntoView(nsIPresContext* aPresContext) if (aPresContext) { nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->ScrollFrameIntoView(this, + if (presShell) { + presShell->ScrollFrameIntoView(this, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); - + } } } diff --git a/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp b/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp index b89989a6c18..2ef2900831d 100644 --- a/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp +++ b/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp @@ -276,9 +276,10 @@ nsIsIndexFrame::ScrollIntoView(nsIPresContext* aPresContext) if (aPresContext) { nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->ScrollFrameIntoView(this, + if (presShell) { + presShell->ScrollFrameIntoView(this, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); - + } } } diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.cpp b/mozilla/layout/html/forms/src/nsListControlFrame.cpp index 07ac05cd303..45d0acb322b 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsListControlFrame.cpp @@ -2034,9 +2034,10 @@ nsListControlFrame::ScrollIntoView(nsIPresContext* aPresContext) if (aPresContext) { nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->ScrollFrameIntoView(this, + if (presShell) { + presShell->ScrollFrameIntoView(this, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); - + } } }