зеркало из https://github.com/mozilla/pjs.git
Bug 28670: Move scroll methods from webshell to docshell and XUL scrollbar removal from XULDocument to here r=travis a=rickg
This commit is contained in:
Родитель
44668d5ea8
Коммит
4f12cda18b
|
@ -115,6 +115,7 @@
|
|||
#include "nsDocument.h"
|
||||
#include "nsToolbarItemFrame.h"
|
||||
#include "nsXULCheckboxFrame.h"
|
||||
#include "nsIScrollable.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
static PRBool gNoisyContentUpdates = PR_FALSE;
|
||||
|
@ -2566,21 +2567,35 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
// As long as the webshell doesn't prohibit it, and the device supports
|
||||
// it, create a scroll frame that will act as the scolling mechanism for
|
||||
// the viewport.
|
||||
nsISupports* container;
|
||||
//
|
||||
// Threre are three possible values stored in the docshell:
|
||||
// 1) NS_STYLE_OVERFLOW_HIDDEN = no scrollbars
|
||||
// 2) NS_STYLE_OVERFLOW_AUTO = scrollbars appear if needed
|
||||
// 3) NS_STYLE_OVERFLOW_SCROLL = scrollbars always
|
||||
// Only need to create a scroll frame/view for cases 2 and 3.
|
||||
// Currently OVERFLOW_SCROLL isn't honored, as
|
||||
// scrollportview::SetScrollPref is not implemented.
|
||||
PRInt32 nameSpaceID; // Never create scrollbars for XUL documents
|
||||
if (NS_SUCCEEDED(aDocElement->GetNameSpaceID(nameSpaceID)) &&
|
||||
nameSpaceID == nsXULAtoms::nameSpaceID) {
|
||||
isScrollable = PR_FALSE;
|
||||
} else {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISupports> container;
|
||||
if (nsnull != aPresContext) {
|
||||
aPresContext->GetContainer(&container);
|
||||
aPresContext->GetContainer(getter_AddRefs(container));
|
||||
if (nsnull != container) {
|
||||
nsIWebShell* webShell = nsnull;
|
||||
container->QueryInterface(kIWebShellIID, (void**) &webShell);
|
||||
if (nsnull != webShell) {
|
||||
nsCOMPtr<nsIScrollable> scrollableContainer = do_QueryInterface(container, &rv);
|
||||
if (NS_SUCCEEDED(rv) && scrollableContainer) {
|
||||
PRInt32 scrolling = -1;
|
||||
webShell->GetScrolling(scrolling);
|
||||
// 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) {
|
||||
isScrollable = PR_FALSE;
|
||||
}
|
||||
NS_RELEASE(webShell);
|
||||
// XXX NS_STYLE_OVERFLOW_SCROLL should create 'always on' scrollbars
|
||||
}
|
||||
}
|
||||
NS_RELEASE(container);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
#include "nsDocument.h"
|
||||
#include "nsToolbarItemFrame.h"
|
||||
#include "nsXULCheckboxFrame.h"
|
||||
#include "nsIScrollable.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
static PRBool gNoisyContentUpdates = PR_FALSE;
|
||||
|
@ -2566,21 +2567,35 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
// As long as the webshell doesn't prohibit it, and the device supports
|
||||
// it, create a scroll frame that will act as the scolling mechanism for
|
||||
// the viewport.
|
||||
nsISupports* container;
|
||||
//
|
||||
// Threre are three possible values stored in the docshell:
|
||||
// 1) NS_STYLE_OVERFLOW_HIDDEN = no scrollbars
|
||||
// 2) NS_STYLE_OVERFLOW_AUTO = scrollbars appear if needed
|
||||
// 3) NS_STYLE_OVERFLOW_SCROLL = scrollbars always
|
||||
// Only need to create a scroll frame/view for cases 2 and 3.
|
||||
// Currently OVERFLOW_SCROLL isn't honored, as
|
||||
// scrollportview::SetScrollPref is not implemented.
|
||||
PRInt32 nameSpaceID; // Never create scrollbars for XUL documents
|
||||
if (NS_SUCCEEDED(aDocElement->GetNameSpaceID(nameSpaceID)) &&
|
||||
nameSpaceID == nsXULAtoms::nameSpaceID) {
|
||||
isScrollable = PR_FALSE;
|
||||
} else {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISupports> container;
|
||||
if (nsnull != aPresContext) {
|
||||
aPresContext->GetContainer(&container);
|
||||
aPresContext->GetContainer(getter_AddRefs(container));
|
||||
if (nsnull != container) {
|
||||
nsIWebShell* webShell = nsnull;
|
||||
container->QueryInterface(kIWebShellIID, (void**) &webShell);
|
||||
if (nsnull != webShell) {
|
||||
nsCOMPtr<nsIScrollable> scrollableContainer = do_QueryInterface(container, &rv);
|
||||
if (NS_SUCCEEDED(rv) && scrollableContainer) {
|
||||
PRInt32 scrolling = -1;
|
||||
webShell->GetScrolling(scrolling);
|
||||
// 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) {
|
||||
isScrollable = PR_FALSE;
|
||||
}
|
||||
NS_RELEASE(webShell);
|
||||
// XXX NS_STYLE_OVERFLOW_SCROLL should create 'always on' scrollbars
|
||||
}
|
||||
}
|
||||
NS_RELEASE(container);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче