зеркало из https://github.com/mozilla/pjs.git
Bug 550882. Make sure to create scrollbars for the viewport even if it's currently overflow:hidden, since various changes to <body> and the like can change the propagated overflow. r=roc
This commit is contained in:
Родитель
1dd50deefa
Коммит
ca700d3e0d
|
@ -2175,26 +2175,24 @@ nsGfxScrollFrameInner::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
|
|||
|
||||
nsIScrollableFrame *scrollable = do_QueryFrame(mOuter);
|
||||
|
||||
// At this stage in frame construction, the document element and/or
|
||||
// BODY overflow styles have not yet been propagated to the
|
||||
// viewport. So GetScrollbarStylesFromFrame called here will only
|
||||
// take into account the scrollbar preferences set on the docshell.
|
||||
// Thus if no scrollbar preferences are set on the docshell, we will
|
||||
// always create scrollbars, which means later dynamic changes to
|
||||
// propagated overflow styles will show or hide scrollbars on the
|
||||
// viewport without requiring frame reconstruction of the viewport
|
||||
// (good!).
|
||||
|
||||
// XXX On the other hand, if scrolling="no" is set on the container
|
||||
// we won't create scrollbars here so no scrollbars will ever be
|
||||
// created even if the container's scrolling attribute is later
|
||||
// changed. However, this has never been supported.
|
||||
ScrollbarStyles styles = scrollable->GetScrollbarStyles();
|
||||
PRBool canHaveHorizontal = styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN;
|
||||
PRBool canHaveVertical = styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN;
|
||||
if (!canHaveHorizontal && !canHaveVertical) {
|
||||
// Nothing to do.
|
||||
return NS_OK;
|
||||
// If we're the scrollframe for the root, then we want to construct
|
||||
// our scrollbar frames no matter what. That way later dynamic
|
||||
// changes to propagated overflow styles will show or hide
|
||||
// scrollbars on the viewport without requiring frame reconstruction
|
||||
// of the viewport (good!).
|
||||
PRBool canHaveHorizontal;
|
||||
PRBool canHaveVertical;
|
||||
if (!mIsRoot) {
|
||||
ScrollbarStyles styles = scrollable->GetScrollbarStyles();
|
||||
canHaveHorizontal = styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN;
|
||||
canHaveVertical = styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN;
|
||||
if (!canHaveHorizontal && !canHaveVertical) {
|
||||
// Nothing to do.
|
||||
return NS_OK;
|
||||
}
|
||||
} else {
|
||||
canHaveHorizontal = PR_TRUE;
|
||||
canHaveVertical = PR_TRUE;
|
||||
}
|
||||
|
||||
// The anonymous <div> used by <inputs> never gets scrollbars.
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
<!DOCTYPE html>
|
||||
<iframe src="data:text/html,<html></html>"></iframe>
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<iframe src="data:text/html,<html style='height: 100%; overflow: visible'>
|
||||
<body style='margin: 0; padding: 0; height: 100%'
|
||||
onload='document.body.offsetWidth;
|
||||
document.documentElement.style.overflow="hidden"'>
|
||||
<div style='width: 200%; height: 200%'></div>
|
||||
</body>
|
||||
</html>"></iframe>
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<iframe src="data:text/html,<html style='height: 100%'>
|
||||
<body style='margin: 0; padding: 0; height: 100%'>
|
||||
<div style='width: 200%; height: 200%'></div>
|
||||
</body>
|
||||
</html>"></iframe>
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<iframe src="data:text/html,<html style='height: 100%'>
|
||||
<body style='margin: 0; padding: 0; height: 100%; overflow: hidden'
|
||||
onload='document.body.offsetWidth;
|
||||
document.body.style.overflow=""'>
|
||||
<div style='width: 200%; height: 200%'></div>
|
||||
</body>
|
||||
</html>"></iframe>
|
|
@ -0,0 +1,2 @@
|
|||
<!DOCTYPE html>
|
||||
<iframe src="data:text/html,<html></html>"></iframe>
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<iframe src="data:text/html,<html style='height: 100%'>
|
||||
<body style='margin: 0; padding: 0; height: 100%; overflow: visible'
|
||||
onload='document.body.offsetWidth;
|
||||
document.body.style.overflow="hidden"'>
|
||||
<div style='width: 200%; height: 200%'></div>
|
||||
</body>
|
||||
</html>"></iframe>
|
Загрузка…
Ссылка в новой задаче