From f8361bf5d6ff0faedb36724ab5a3e8f0be649356 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Fri, 3 Sep 2004 21:58:39 +0000 Subject: [PATCH] Land bug 72747 in pieces: make users of nsIScrollable use nsIScrollable::Scrollbar_* instead of NS_STYLE_OVERFLOW_*. b=72747 r+sr=roc git-svn-id: svn://10.0.0.236/trunk@161727 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsDocumentViewer.cpp | 4 +-- .../html/document/src/nsHTMLContentSink.cpp | 4 +-- mozilla/docshell/base/nsDocShell.cpp | 4 +-- mozilla/dom/src/base/nsBarProps.cpp | 11 ++++---- mozilla/layout/base/nsCSSFrameConstructor.cpp | 2 +- mozilla/layout/base/nsDocumentViewer.cpp | 4 +-- mozilla/layout/generic/nsFrameFrame.cpp | 25 ++++++++++--------- .../layout/html/document/src/nsFrameFrame.cpp | 25 ++++++++++--------- .../html/style/src/nsCSSFrameConstructor.cpp | 2 +- 9 files changed, 41 insertions(+), 40 deletions(-) diff --git a/mozilla/content/base/src/nsDocumentViewer.cpp b/mozilla/content/base/src/nsDocumentViewer.cpp index d9173c5d5f0..088a22c32b2 100644 --- a/mozilla/content/base/src/nsDocumentViewer.cpp +++ b/mozilla/content/base/src/nsDocumentViewer.cpp @@ -689,9 +689,9 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow) // inside the frameset... sc->SetCurrentScrollbarPreferences(nsIScrollable::ScrollOrientation_Y, - NS_STYLE_OVERFLOW_HIDDEN); + nsIScrollable::Scrollbar_Never); sc->SetCurrentScrollbarPreferences(nsIScrollable::ScrollOrientation_X, - NS_STYLE_OVERFLOW_HIDDEN); + nsIScrollable::Scrollbar_Never); } else { sc->ResetScrollbarPreferences(); } diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index 0b99103f65b..650b90da514 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -3654,10 +3654,10 @@ HTMLContentSink::StartLayout() if (mFrameset) { scrollableContainer-> SetCurrentScrollbarPreferences(nsIScrollable::ScrollOrientation_Y, - NS_STYLE_OVERFLOW_HIDDEN); + nsIScrollable::Scrollbar_Never); scrollableContainer-> SetCurrentScrollbarPreferences(nsIScrollable::ScrollOrientation_X, - NS_STYLE_OVERFLOW_HIDDEN); + nsIScrollable::Scrollbar_Never); } else { scrollableContainer->ResetScrollbarPreferences(); } diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 137e76dcabe..e412428bd2a 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -268,8 +268,8 @@ nsDocShell::nsDocShell(): mMarginHeight(0), mItemType(typeContent), mContentListener(nsnull), - mCurrentScrollbarPref(-1, -1), - mDefaultScrollbarPref(-1, -1), + mCurrentScrollbarPref(Scrollbar_Auto, Scrollbar_Auto), + mDefaultScrollbarPref(Scrollbar_Auto, Scrollbar_Auto), mEditorData(nsnull), mParent(nsnull), mTreeOwner(nsnull), diff --git a/mozilla/dom/src/base/nsBarProps.cpp b/mozilla/dom/src/base/nsBarProps.cpp index 6eb053d02c0..4bb25ae7406 100644 --- a/mozilla/dom/src/base/nsBarProps.cpp +++ b/mozilla/dom/src/base/nsBarProps.cpp @@ -275,15 +275,14 @@ ScrollbarsPropImpl::GetVisible(PRBool *aVisible) do_QueryInterface(mDOMWindow->GetDocShell()); if (scroller) { - PRInt32 prefValue = aVisible ? NS_STYLE_OVERFLOW_AUTO : - NS_STYLE_OVERFLOW_HIDDEN; + PRInt32 prefValue; scroller->GetDefaultScrollbarPreferences( nsIScrollable::ScrollOrientation_Y, &prefValue); - if (prefValue == NS_STYLE_OVERFLOW_HIDDEN) // try the other way + if (prefValue == nsIScrollable::Scrollbar_Never) // try the other way scroller->GetDefaultScrollbarPreferences( nsIScrollable::ScrollOrientation_X, &prefValue); - if (prefValue == NS_STYLE_OVERFLOW_HIDDEN) + if (prefValue == nsIScrollable::Scrollbar_Never) *aVisible = PR_FALSE; } } @@ -307,8 +306,8 @@ ScrollbarsPropImpl::SetVisible(PRBool aVisible) do_QueryInterface(mDOMWindow->GetDocShell()); if (scroller) { - PRInt32 prefValue = aVisible ? NS_STYLE_OVERFLOW_AUTO : - NS_STYLE_OVERFLOW_HIDDEN; + PRInt32 prefValue = aVisible ? nsIScrollable::Scrollbar_Auto : + nsIScrollable::Scrollbar_Never ; scroller->SetDefaultScrollbarPreferences( nsIScrollable::ScrollOrientation_Y, prefValue); scroller->SetDefaultScrollbarPreferences( diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 0f246117543..5fad6370a4f 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -3854,7 +3854,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell, PRInt32 scrolling = -1; // XXX We should get prefs for X and Y and deal with these independently! scrollableContainer->GetCurrentScrollbarPreferences(nsIScrollable::ScrollOrientation_Y,&scrolling); - if (NS_STYLE_OVERFLOW_HIDDEN == scrolling) { + if (nsIScrollable::Scrollbar_Never == scrolling) { isScrollable = PR_FALSE; } // XXX NS_STYLE_OVERFLOW_SCROLL should create 'always on' scrollbars diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index d9173c5d5f0..088a22c32b2 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -689,9 +689,9 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow) // inside the frameset... sc->SetCurrentScrollbarPreferences(nsIScrollable::ScrollOrientation_Y, - NS_STYLE_OVERFLOW_HIDDEN); + nsIScrollable::Scrollbar_Never); sc->SetCurrentScrollbarPreferences(nsIScrollable::ScrollOrientation_X, - NS_STYLE_OVERFLOW_HIDDEN); + nsIScrollable::Scrollbar_Never); } else { sc->ResetScrollbarPreferences(); } diff --git a/mozilla/layout/generic/nsFrameFrame.cpp b/mozilla/layout/generic/nsFrameFrame.cpp index 63f215c82b8..e363f669351 100644 --- a/mozilla/layout/generic/nsFrameFrame.cpp +++ b/mozilla/layout/generic/nsFrameFrame.cpp @@ -648,23 +648,24 @@ nsSubDocumentFrame::ShowDocShell() PRInt32 scrolling = GetStyleDisplay()->mOverflow; PRInt32 scrollX, scrollY; switch (scrolling) { + case NS_STYLE_OVERFLOW_VISIBLE: + case NS_STYLE_OVERFLOW_AUTO: + scrollX = scrollY = nsIScrollable::Scrollbar_Auto; + break; + case NS_STYLE_OVERFLOW_HIDDEN: case NS_STYLE_OVERFLOW_CLIP: - scrollX = NS_STYLE_OVERFLOW_HIDDEN; - scrollY = NS_STYLE_OVERFLOW_HIDDEN; + scrollX = scrollY = nsIScrollable::Scrollbar_Never; + break; + case NS_STYLE_OVERFLOW_SCROLL: + scrollX = scrollY = nsIScrollable::Scrollbar_Always; break; case NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL: - scrollX = NS_STYLE_OVERFLOW_SCROLL; - scrollY = NS_STYLE_OVERFLOW_HIDDEN; + scrollX = nsIScrollable::Scrollbar_Always; + scrollY = nsIScrollable::Scrollbar_Never; break; case NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL: - scrollX = NS_STYLE_OVERFLOW_HIDDEN; - scrollY = NS_STYLE_OVERFLOW_SCROLL; - break; - case NS_STYLE_OVERFLOW_VISIBLE: - scrollX = scrollY = NS_STYLE_OVERFLOW_AUTO; - break; - default: - scrollX = scrollY = scrolling; + scrollX = nsIScrollable::Scrollbar_Never; + scrollY = nsIScrollable::Scrollbar_Always; break; } diff --git a/mozilla/layout/html/document/src/nsFrameFrame.cpp b/mozilla/layout/html/document/src/nsFrameFrame.cpp index 63f215c82b8..e363f669351 100644 --- a/mozilla/layout/html/document/src/nsFrameFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameFrame.cpp @@ -648,23 +648,24 @@ nsSubDocumentFrame::ShowDocShell() PRInt32 scrolling = GetStyleDisplay()->mOverflow; PRInt32 scrollX, scrollY; switch (scrolling) { + case NS_STYLE_OVERFLOW_VISIBLE: + case NS_STYLE_OVERFLOW_AUTO: + scrollX = scrollY = nsIScrollable::Scrollbar_Auto; + break; + case NS_STYLE_OVERFLOW_HIDDEN: case NS_STYLE_OVERFLOW_CLIP: - scrollX = NS_STYLE_OVERFLOW_HIDDEN; - scrollY = NS_STYLE_OVERFLOW_HIDDEN; + scrollX = scrollY = nsIScrollable::Scrollbar_Never; + break; + case NS_STYLE_OVERFLOW_SCROLL: + scrollX = scrollY = nsIScrollable::Scrollbar_Always; break; case NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL: - scrollX = NS_STYLE_OVERFLOW_SCROLL; - scrollY = NS_STYLE_OVERFLOW_HIDDEN; + scrollX = nsIScrollable::Scrollbar_Always; + scrollY = nsIScrollable::Scrollbar_Never; break; case NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL: - scrollX = NS_STYLE_OVERFLOW_HIDDEN; - scrollY = NS_STYLE_OVERFLOW_SCROLL; - break; - case NS_STYLE_OVERFLOW_VISIBLE: - scrollX = scrollY = NS_STYLE_OVERFLOW_AUTO; - break; - default: - scrollX = scrollY = scrolling; + scrollX = nsIScrollable::Scrollbar_Never; + scrollY = nsIScrollable::Scrollbar_Always; break; } diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 0f246117543..5fad6370a4f 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -3854,7 +3854,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell, PRInt32 scrolling = -1; // XXX We should get prefs for X and Y and deal with these independently! scrollableContainer->GetCurrentScrollbarPreferences(nsIScrollable::ScrollOrientation_Y,&scrolling); - if (NS_STYLE_OVERFLOW_HIDDEN == scrolling) { + if (nsIScrollable::Scrollbar_Never == scrolling) { isScrollable = PR_FALSE; } // XXX NS_STYLE_OVERFLOW_SCROLL should create 'always on' scrollbars